¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Inheritance

John Poulos Computer Science Inglés

Inheritance

Contenido del mapa

Inheritance

  1. Extending a class or subclassing or inheriting a class using keyword 'extends'

    • Inheritance allows you to add methods that don't exist in the original class while still retaining the original features.
      • Java does not inherit from multiple classes. Can't extend a class from two different classes.
        • Interface gets around this issue and supports the functionality of multiple inheritance.
      • Can continue to subclass as needed. The final keyword prevents further subclassing.
        • Multilevel inheritance has limits to access to distant classes. Grandparent ---> Parent ----> Child Child has no access to grandparent.
  2. ·

    • Line points towards generalization.
  3. extends used in code: public class Parent {}

    • public class Child extends Parent {}
      • All Java classes automatically extend java.lang.Object Class
      • Parent class is a subclass to Object class in Java
      • As-Is Relationship: Animal (parent class) <--- Fox(child class)
  4. Accessibility

    • From inside a subclass, you can use the parent class's public and protected methods and fields. You can not use the private methods. If both parent and child classes are in the same package, the child can also access the parent's default methods and fields.
    • Method Overriding
      • When the child class's methods are used in place of the parent class. This is done by using the same name and allows Java to have runtime polymorphism, the ability to change functionality depending on which class's method is used.
    • Method Overloading
      • This allows a class to have more than one method with the same name but with different parameters. This increases readability of the code.
  5. Typecasting

    • You can change the type of the subclass to the parent class's type. Also known as upcasting.

Imágenes y archivos del mapa

  • Inheritance

Información

Descripción
Computer Science Mapa Mental sobre Inheritance, creado por John Poulos el 04/08/2019.
Creado por
John Poulos
Visitas
0
Historial
  • Creado por John Poulos · 3 ago 2019
  • Copiado por John Poulos · 3 ago 2019
  • Copiado por John Poulos · 4 ago 2019
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?