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

Mapa mental

Chapter 6: Inheritance

Hae Won Kim Inglés

Contenido del mapa

Chapter 6: Inheritance

  1. The process of extending a class in OOP

  2. 'extends' Keyword

    • used to extend a class in the class declaration, after class name but before parent class
    • In Java, only one inheritance allowed per class
      • Multiple inheritance can be achieved through use of interfaces
  3. Accessibility

    • Subclass can access public and protected methods & fields of superclass, but not private methods
    • Can access default methods and fields if subclass and superclass are in same package
  4. The 'is-a' Relationship

    • Special relationship that is formed between the subclass and superclass when you create a new class with inheritance
      • subclass is special type of superclass
      • Subclass inherits all public methods and fields of its superclass
  5. Method Overriding

    • Done by writing a method in the subclass that has the same signature as a method in the parent class
      • Can override superclass's public & protected methods
      • Method Overloading
        • Creating a method in subclass with the same name but different list of arguments
      • Can override default methods when in same package
      • Cannot override a final method
    • Changing the behavior of a method in the parent class
  6. Calling Superclass Constructors

    • When creating a child object, all parent classes are also instantiated
    • super keyword
      • An instance of the direct superclass of the current object
  7. Calling Superclass Hidden Members

    • super keyword
      • Can access any member in the superclass that is visible to subclass
      • To call a hidden member or an overridden method in superclass
  8. Type Casting

    • Upcasting
      • Assign object of type subclass to a reference variable of type superclass
      • Can cast an instance of a subclass to its parent class
    • Downcasting
      • Casting an object to a class down the inheritance hierarchy
      • Only allowed if parent class reference is already pointing to an instance of subclass
  9. Final Classes

    • final keyword
      • Prevents extension of class
  10. 'instanceOf' Keyword

    • Used to test if an object is of a specified type

Información

Descripción
Mapa Mental sobre Chapter 6: Inheritance, creado por Hae Won Kim el 23/11/2019.
Creado por
Hae Won Kim
Visitas
0
Historial
  • Creado por Samantha Sullivan · 21 nov 2019
  • Copiado por Hae Won Kim · 23 nov 2019
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?