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

Mindmap

Inheritance

John Hair Englisch

Inhalt der Mindmap

Inheritance

  1. Hierarchies

    • Parent Class: Also known as the super class, gives the child class (sub class) methods and variables.
    • Child Class: Also known as the sub class, it takes the methods and variables from the super class. Thanks to polymorphism, can be casted to the super class type. It uses the extends keyword.
  2. Inheriting Fields and Methods

    • Sub classes automatically inherit methods and fields. You can not use the same name for a instance variable that is already used in the super class, but you can overwrite a method to fit the sub class better.
  3. Subclass construction

    • Created just like a regular class, but uses the extends keyword followed by the
  4. Converting between subclasses and superclasses: Objects of Subclasses can convert to superclasses, but objects of super classes can not be converted to sub classes.

  5. Super(): is used in the constructor of the child class to give the parent class the required parameters

  6. Abstract Classes: Classes that have one or more abstract methods with at least one regular method. When a sub class extends an abstract class, they must write the code for the abstract methods.

  7. Access control

    • Public: Available to all classes in the same package
    • Private: Available to only the class it is created in, requires accessor method to get.
    • Protected: Protected data in an object can be accessed by the methods of the object’s class and all its subclasses.
  8. Super: keyword that can be used to call methods of the superclass

  9. Object Super class: Default extension when creating a class. Methods can be overwritten.

    • toString: returns a string of the location in memory
    • equals: sees if the two objects have the same location in memory

Informationen

Beschreibung
Mindmap am Inheritance, erstellt von John Hair am 03/05/2018.
Erstellt von
John Hair · Mai 2018
Aktualisiert
3 Mai 2018
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck