9
INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES PROGRAMACION ORIENTADA A OBJETOS (POO) POLIMORFISMO RUTH LÒPEZ MUÑOZ

INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

  • Upload
    dagan

  • View
    44

  • Download
    0

Embed Size (px)

DESCRIPTION

INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES PROGRAMACION ORIENTADA A OBJETOS (POO) POLIMORFISMO RUTH LÒPEZ MUÑOZ. CONCEPTO. - PowerPoint PPT Presentation

Citation preview

Page 1: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES

INGENIERIA EN SISTEMAS COMPUTACIONALES

PROGRAMACION ORIENTADA A OBJETOS (POO)

POLIMORFISMO

RUTH LÒPEZ MUÑOZ

Page 2: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

CONCEPTO

En programación orientada a objetos el polimorfismo se refiere a la capacidad para que varias clases derivadas de una antecesora utilicen un mismo método de forma diferente.

Page 3: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

CLASIFICACIÓN

Polimorfismo dinámico

Polimorfismo estático

Page 4: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

POLIMORFISMO DINAMICO

Es aquél en el que el código no incluye ningún tipo de especificación sobre el tipo de datos sobre el que se trabaja. Así, puede ser utilizado a todo tipo de datos compatible.

Page 5: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

POLIMORFISMO ESTÁTICO

Es aquél en el que los tipos a los que se aplica el polimorfismo deben ser explicitados y declarados uno por uno antes de poder ser utilizados.

Page 6: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

EJEMPLO DE POLIMORFISMO

Podemos crear dos clases distintas: Pez y Ave que heredan de la superclase Animal. La clase Animal tiene el método abstracto mover que se implementa de forma distinta en cada una de las subclases (peces y aves se mueven de forma distinta).

Page 7: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

Como ya mencionó anteriormente, el concepto de polimorfismo se puede aplicar tanto a funciones como a tipos de datos. Así nacen los conceptos de funciones polimórficas y tipos polimórficos.

Page 8: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

FUNCIONES POLIMÓRFICAS

Son aquellas funciones que pueden evaluarse o ser aplicadas a diferentes tipos de datos de forma indistinta.

Page 9: INSTITUTO TECNOLOGICO SUPERIOR DE LIBRES INGENIERIA EN SISTEMAS COMPUTACIONALES

TIPOS POLIMÓRFICOS

Son aquellos tipos de datos que contienen al menos un elemento cuyo tipo no está especificado.