SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
Desarrollo de Funciones en el Sistema Informático
                                                       Curso 2009/2010




Programación orientada a objetos (y II)
       Presentación en diapositivas (PRE10)
Desarrollo de Funciones en el Sistema Informático
                                                                  Curso 2009/2010



             Herencia y polimorfismo
Ambas propiedades son esenciales en la POO

Comentaremos únicamente las diferencias respecto a C++, que son:
●
    Referencias this y super
●   Clase Object
●
    Polimorfismo
●
    Paquetes
●   La API


¡¡IMPORTANTE!!
Las clases y métodos abstractos, las clases y métodos finales y las
  interfaces están fuera de los objetivos de este módulo.
Desarrollo de Funciones en el Sistema Informático
                                                                                                    Curso 2009/2010



                 Las referencias this y super
Java permite el acceso a atributos/métodos del propio objeto → this
Ejemplo:
class Alumno() {
                                                                     String nombre;
 String nombre;
 GregorianCalendar fechaNacimiento;
 boolean ocupado;
                                                                     GregorianCalendar fechaNacimiento;
    int calculaEdad() {
          GregorianCalendar hoy = new GregorianCalendar();
                                                                     boolean ocupado;
          hoy.getTime();
                                                                                                                 this.fechaNacimiento
          return (this.fechaNacimiento – hoy)
       }                                                                                                                      Métodos
}                                                                                                Atributos
                                                                                                                  Clase Alumno
Java permite el acceso a atributos/métodos del objeto de la superclase → super
Ejemplo:
class Alumno() {
  int calculaEdad() { ... }
}
                                                             ...                                                             ...
class AlumnoCiclos extends Alumno() {                                                   hereda
  int calculaEdad() { super.calculaEdad(); }         Atributos                                                           Atributos
}                                                                     calculaEdad()                    super.calculaEdad()
                                                                          Métodos                      Métodos
                                                                     Clase Alumno                         Clase AlumnoCiclos
Desarrollo de Funciones en el Sistema Informático
                                                                      Curso 2009/2010



                    La clase Object
                                Clase Object
                   Métodos                            Explicación
+equals (Object obj): boolean                 Compara el contenido de 2 objetos

#Clone(): Object                              Retorna una copia del objeto




                                   hereda




                                resto de clases
Desarrollo de Funciones en el Sistema Informático
                                                                                   Curso 2009/2010



                                   Polimorfismo
Capacidad de una variable de poder tomar varias formas.
Ejemplo:

                                              hereda




                               Clase Alumno                 Clase AlumnoCiclos



En este caso, podríamos hacer:
Alumno alumnoUno = new Alumno();

Alumno alumnoDos = new Alumno();
Desarrollo de Funciones en el Sistema Informático
                                                                                            Curso 2009/2010



                                           Paquetes
●   Es la forma en la que Java organiza las clases.
●   Las clases de un mismo paquete tienen alguna relación entre ellas.
●   Ejemplos:
     ●    java.lang. Incluye clases fundamentales.
     ●    java.io. Tiene clases para gestionar la e/s.
Definición de paquetes
package nombrePaquete;         // Si no se define, se incluye en default package


Acceso a una clase
●   Nombre completo: nombrePaquete.nombreClase
●   Mediante import:
     1.   import nombrePaquete.nombreClase; // importa sólo la clase                por convención, java.lang
                                                                                     se importa por defecto
     2.   Import nombrePaquete.*               // importa todo el paquete
Desarrollo de Funciones en el Sistema Informático
                                                                                  Curso 2009/2010



                                         La API
Biblioteca con funciones organizadas en paquetes. Las principales son:

  Paquete                                      Clases incorporadas
java.lang     Clases fundamentales para el lenguaje, como la clase String y otras.
java.io       Clases para entrada y salida a través de flujos de datos y ficheros del sistema.
java.util     Clases de utilidad, como colecciones de datos y clases o facilidades horarias.
java.math     Clase que agrupa todas las funciones matemáticas.
java.applet   Clase con utilidades para crear applets y clases que los applets necesitan para
              comunicarse con su contexto.
java.awt      Clases que permiten la creación de interfaces gráficas con el usuario.
java.swing    Clases con componentes gráficos que funcionan igual en todas las plataformas Java.
java.security Clases responsables de la seguridad en Java (encriptación, etc.).

java.net      Clases con funciones para aplicaciones en red.
java.sql      Clase que incorpora el JDBC para la conexión de Java con bases de datos.
Desarrollo de Funciones en el Sistema Informático
                                                                                                                          Curso 2009/2010




         Programación orientada a objetos (y II)
                                           Presentación en diapositivas (PRE10)




                   Esta obra de Cristian Jorge Garcia Marcos está bajo una licencia Reconocimiento-Compartir bajo la misma licencia 3.0 España de Creative Commons.
                   Para ver una copia de esta licencia, visite http://creativecommons.org/licenses/by-sa/3.0/es/ o envíe una carta a Creative Commons, 171
                   SecondStreet, Suite 300, San Francisco, California 94105, USA



Basado en el documento:
López, J. A. P., Xirgo, L. R. (2008, February 18). Introducción al desarrollo de software. Retrieved February 25, 2010, from UOCOpenCourseWare Web site: http://ocw.uoc.edu/informatica-
tecnologia-y-multimedia/introduccion-al-desarrollo-de-software, publicado bajo una licencia GNU Free Document License.

Mais conteúdo relacionado

Último

TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOSTEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOSjlorentemartos
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.amayarogel
 
Heinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoHeinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoFundación YOD YOD
 
GUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdf
GUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdfGUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdf
GUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdfPaolaRopero2
 
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdfSELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdfAngélica Soledad Vega Ramírez
 
Planificacion Anual 2do Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 2do Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 2do Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 2do Grado Educacion Primaria 2024 Ccesa007.pdfDemetrio Ccesa Rayme
 
Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Lourdes Feria
 
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdfEjercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdfMaritzaRetamozoVera
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxlclcarmen
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAEl Fortí
 
Sesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxSesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxMaritzaRetamozoVera
 
Ecosistemas Natural, Rural y urbano 2021.pptx
Ecosistemas Natural, Rural y urbano  2021.pptxEcosistemas Natural, Rural y urbano  2021.pptx
Ecosistemas Natural, Rural y urbano 2021.pptxolgakaterin
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdfDemetrio Ccesa Rayme
 
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxzulyvero07
 
Curso = Metodos Tecnicas y Modelos de Enseñanza.pdf
Curso = Metodos Tecnicas y Modelos de Enseñanza.pdfCurso = Metodos Tecnicas y Modelos de Enseñanza.pdf
Curso = Metodos Tecnicas y Modelos de Enseñanza.pdfFrancisco158360
 
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSOCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSYadi Campos
 
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Carlos Muñoz
 
Estrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónEstrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónLourdes Feria
 

Último (20)

Sesión de clase: Fe contra todo pronóstico
Sesión de clase: Fe contra todo pronósticoSesión de clase: Fe contra todo pronóstico
Sesión de clase: Fe contra todo pronóstico
 
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOSTEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
TEMA 13 ESPAÑA EN DEMOCRACIA:DISTINTOS GOBIERNOS
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.
 
Heinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoHeinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativo
 
GUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdf
GUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdfGUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdf
GUIA DE CIRCUNFERENCIA Y ELIPSE UNDÉCIMO 2024.pdf
 
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdfSELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
 
Planificacion Anual 2do Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 2do Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 2do Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 2do Grado Educacion Primaria 2024 Ccesa007.pdf
 
Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...
 
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdfEjercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
Ejercicios de PROBLEMAS PAEV 6 GRADO 2024.pdf
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
 
Sesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxSesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docx
 
Ecosistemas Natural, Rural y urbano 2021.pptx
Ecosistemas Natural, Rural y urbano  2021.pptxEcosistemas Natural, Rural y urbano  2021.pptx
Ecosistemas Natural, Rural y urbano 2021.pptx
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
 
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
 
Curso = Metodos Tecnicas y Modelos de Enseñanza.pdf
Curso = Metodos Tecnicas y Modelos de Enseñanza.pdfCurso = Metodos Tecnicas y Modelos de Enseñanza.pdf
Curso = Metodos Tecnicas y Modelos de Enseñanza.pdf
 
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSOCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
 
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
 
Estrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónEstrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcción
 
Fe contra todo pronóstico. La fe es confianza.
Fe contra todo pronóstico. La fe es confianza.Fe contra todo pronóstico. La fe es confianza.
Fe contra todo pronóstico. La fe es confianza.
 

Destaque

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Destaque (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Programación orientada a objetos (y II)

  • 1. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 Programación orientada a objetos (y II) Presentación en diapositivas (PRE10)
  • 2. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 Herencia y polimorfismo Ambas propiedades son esenciales en la POO Comentaremos únicamente las diferencias respecto a C++, que son: ● Referencias this y super ● Clase Object ● Polimorfismo ● Paquetes ● La API ¡¡IMPORTANTE!! Las clases y métodos abstractos, las clases y métodos finales y las interfaces están fuera de los objetivos de este módulo.
  • 3. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 Las referencias this y super Java permite el acceso a atributos/métodos del propio objeto → this Ejemplo: class Alumno() { String nombre; String nombre; GregorianCalendar fechaNacimiento; boolean ocupado; GregorianCalendar fechaNacimiento; int calculaEdad() { GregorianCalendar hoy = new GregorianCalendar(); boolean ocupado; hoy.getTime(); this.fechaNacimiento return (this.fechaNacimiento – hoy) } Métodos } Atributos Clase Alumno Java permite el acceso a atributos/métodos del objeto de la superclase → super Ejemplo: class Alumno() { int calculaEdad() { ... } } ... ... class AlumnoCiclos extends Alumno() { hereda int calculaEdad() { super.calculaEdad(); } Atributos Atributos } calculaEdad() super.calculaEdad() Métodos Métodos Clase Alumno Clase AlumnoCiclos
  • 4. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 La clase Object Clase Object Métodos Explicación +equals (Object obj): boolean Compara el contenido de 2 objetos #Clone(): Object Retorna una copia del objeto hereda resto de clases
  • 5. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 Polimorfismo Capacidad de una variable de poder tomar varias formas. Ejemplo: hereda Clase Alumno Clase AlumnoCiclos En este caso, podríamos hacer: Alumno alumnoUno = new Alumno(); Alumno alumnoDos = new Alumno();
  • 6. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 Paquetes ● Es la forma en la que Java organiza las clases. ● Las clases de un mismo paquete tienen alguna relación entre ellas. ● Ejemplos: ● java.lang. Incluye clases fundamentales. ● java.io. Tiene clases para gestionar la e/s. Definición de paquetes package nombrePaquete; // Si no se define, se incluye en default package Acceso a una clase ● Nombre completo: nombrePaquete.nombreClase ● Mediante import: 1. import nombrePaquete.nombreClase; // importa sólo la clase por convención, java.lang se importa por defecto 2. Import nombrePaquete.* // importa todo el paquete
  • 7. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 La API Biblioteca con funciones organizadas en paquetes. Las principales son: Paquete Clases incorporadas java.lang Clases fundamentales para el lenguaje, como la clase String y otras. java.io Clases para entrada y salida a través de flujos de datos y ficheros del sistema. java.util Clases de utilidad, como colecciones de datos y clases o facilidades horarias. java.math Clase que agrupa todas las funciones matemáticas. java.applet Clase con utilidades para crear applets y clases que los applets necesitan para comunicarse con su contexto. java.awt Clases que permiten la creación de interfaces gráficas con el usuario. java.swing Clases con componentes gráficos que funcionan igual en todas las plataformas Java. java.security Clases responsables de la seguridad en Java (encriptación, etc.). java.net Clases con funciones para aplicaciones en red. java.sql Clase que incorpora el JDBC para la conexión de Java con bases de datos.
  • 8. Desarrollo de Funciones en el Sistema Informático Curso 2009/2010 Programación orientada a objetos (y II) Presentación en diapositivas (PRE10) Esta obra de Cristian Jorge Garcia Marcos está bajo una licencia Reconocimiento-Compartir bajo la misma licencia 3.0 España de Creative Commons. Para ver una copia de esta licencia, visite http://creativecommons.org/licenses/by-sa/3.0/es/ o envíe una carta a Creative Commons, 171 SecondStreet, Suite 300, San Francisco, California 94105, USA Basado en el documento: López, J. A. P., Xirgo, L. R. (2008, February 18). Introducción al desarrollo de software. Retrieved February 25, 2010, from UOCOpenCourseWare Web site: http://ocw.uoc.edu/informatica- tecnologia-y-multimedia/introduccion-al-desarrollo-de-software, publicado bajo una licencia GNU Free Document License.