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

Mindmap

Inheritance

Alyssa M. Englisch

Inheritance

Inhalt der Mindmap

Inheritance

  1. The process of extending a class

  2. The child classes inherit all of the methods and fields of the parent class. The child classes can also have new methods and fields as well as the ability to override existing methods from the parent class.

    • Child classes can also be extended to become the "parent" class to another class
      • For a child class to inherit the methods and fields of the parent class, it should be declared using the extends keyword
        • When a class is created by inheritance, the superclass and subclass class have a "is-a" relationship
          • In this example: A Rectangle (Subclass) "is-a" Shape (Superclass) and a Triangle (Subclass) "is-a" Shape (Superclass)
        • Method Overriding
          • A subclass can override a method from its superclass by having a method of the same name and parameters within it
        • Method Overloading
          • A subclass can overload a method from its superclass by having a method of the same name and different within it
      • public class Parent{ }
        • public class Child1 extends Parent { }
        • public class Child2 extends Parent { }
      • This can be achieved using interfaces since a class can only extend one class in Java
    • A class can be declared as final if you no longer want it to be extendible or inherited by a subclass

Bilder und Dateien der Mindmap

  • Inheritance
  • Inheritance

Informationen

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

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck