GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Ch 6: Inheritance

Samantha Sullivan Englisch

Mind map about inheritance in OOP: extends keyword, method overriding, type casting and final classes

Mind map: inheritance in OOP

Inhalt der Mindmap

Ch 6: Inheritance

  1. The process of extending a class in OOP

  2. The 'extends' Keyword

    • used to extend a class in the class declaration, after class name but before parent class
  3. 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
        • Accessibility
          • can access superclass's public and protected methods & fields, but not private methods
  4. Method Overriding

    • changing the behavior of a method in the parent class
      • 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; cannot override final methods
        • 'method overloading' refers to creating a method with the same name but different list of arguments
  5. Calling Superclass's Constructors

    • When creating a child object, all its parent classes are also instantiated
      • the keyword 'super' represents an instance of the direct superclass of the current object
  6. Calling the Superclass's Hidden Members

    • 'super' keyword can be used to call a hidden member or an overridden method in superclass
      • can access any member in the superclass that is visible to subclass
  7. Type Casting

    • can only cast an instance of a subclass to its parent class
      • Upcasting
      • assign object of type subclass to a reference variable of type superclass
  8. Final Classes

    • by using keyword 'final' in class declaration, you can prevent others from extending your class
  9. 'instanceOf' Keyword

    • can be used to test if an object is of a specified type

Informationen

Beschreibung
Mindmap am Ch 6: Inheritance, erstellt von Samantha Sullivan am 21/11/2019.
Erstellt von
Samantha Sullivan
Aufrufe
6
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck