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

Mindmap

Inheritance

Ivan Mitevski Englisch

Inhalt der Mindmap

Inheritance

  1. The process of extending a class in OOP

  2. Gives you the opportunity to add some functionality that does not exist in the original class

  3. Gives the chance to change the behaviors of the existing class to better suit your needs

  4. Extends Keyword

    • Used to extend a class
    • A class can only extend one class
    • Placed in class declaration
  5. Is-a relationship

    • Relationship formed when you create a new class by inheritance
    • Subclass inherits methods from superclass
    • You can assign an instance of a subclass to a reference variable of the parent type
  6. Accessibility

    • In a subclass, the superclass's public and protected methods and fields can be accessed
    • Protected Method
      • Not accessible from outside class except from a subclass
  7. Method Override

    • When extending a class, the behavior of the method of the parent method can be changed
    • To override, write the new method in the subclass
  8. Calling Superclass constructors

    • First thing constructor does is call the no-argument constructor of the direct parent class
    • Process repeats until the constructor of the object class is reached
    • Super Keyword
      • An instance of the direct superclass of the current object
  9. Calling Superclass Hidden Members

    • Super Keyword
      • Used to call a hidden member or an overridden method in the superclass
  10. Type Casting

    • Upcasting
      • Casting an object to a parent class
      • Assign the object to a reference variable of the type Superclass
    • Downcasting
      • Casting an object to a class down
      • Write the child type in brackets
  11. Final

    • Prevents others from extending your class by making it final
  12. instanceof Keyword

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

Informationen

Beschreibung
Mindmap am Inheritance, erstellt von Ivan Mitevski am 21/11/2019.
Erstellt von
Ivan Mitevski
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck