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

Mindmap

Inheritance

Ana Ausek Englisch

Inhalt der Mindmap

Inheritance

  1. Code Extensibility

    • extends keyword; Java only allows 1 extension per class
      • Create new class; subclass
        • Parent-child relationship
          • Method Override
            • Write method with same signature as parent class method
              • Change existing method behaviors
          • Child has "is-a" relationship to Parent
            • Child inherits all public methods of Parent
              • Allows reference variable of parent type in assignment of a subclass instance
                • Subclass can access public and protected just not private methods from superclass
        • keyword new to create an instance
          • When subclass object is instantiated, so are all parent's classes
      • Ex: public class Child extends Parent {}
    • final keyword
      • Prevent method override; no change in behavior allowed
      • Does not permit Method Override
        • Speed improvement but design should be main concern
      • Ex: public final class Pencil{}
    • java.lang.Object
      • Ultimate Java superclass
    • keyword super represents instance of direct superclass of current object
      • Invoke superclass constructor
      • Call a hidden member or an overriden superclass method
    • Type Casting
      • Possible only to cast subclass instance to parent class; "Upcasting"
        • "Downcasting" if parent instance is cast as child class
    • instanceof keyword
      • test if object is of specified type; ex: if it's type of its superclass

Informationen

Beschreibung
Mindmap am Inheritance, erstellt von Ana Ausek am 03/08/2019.
Erstellt von
Ana Ausek
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck