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

Mindmap

Inheritance

Jeremy Deleon Englisch

Inheritance

Inhalt der Mindmap

Inheritance

  1. Extend

    • Done automatically in Java as an Object is the superclass
      • Notation:
  2. The Is-a Relationship

  3. Superclass and subclasses

  4. Accessibility

    • P and C: P has three methods, public, protected and one with default class
      • The subclass C can access all these classes but a method outside of the subclass cannot access the default class
  5. Method Overriding

    • You can change the behavior of a method in a parent class by writing the new method in the subclass. This is possible to do for the public and protected methods. If subclass and superclass are in the same package, then you can also change default access level.
      • You can avoid overriding a method by writing final.
  6. Calling a superclass' no-arg constructor

  7. Calling a superclass' hidden members

      • The Pencil class overrides the toString method in Tool. When you run the Pencil class, you get "Generic Tool// I am a Pencil'
  8. Casting

    • Upcasting: casting an object to a parent class by assigning the object to a reference variable of the parent class
    • Downcasting:casting down an object a class down the inheritance hierarchy. You need to write the object in brackets. Subclass needs to exist in the parent class as a reference or else you get an error
  9. instanceof Keyword: used to test if a object is of a specified type. It is normally used an in if statement.

Bilder und Dateien der Mindmap

  • Inheritance
  • Inheritance
  • Inheritance
  • Inheritance
  • Inheritance
  • Inheritance
  • Inheritance
  • Inheritance
  • Inheritance

Informationen

Beschreibung
Mindmap am Inheritance, erstellt von Jeremy Deleon am 06/08/2019.
Erstellt von
Jeremy Deleon
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck