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

Mindmap

Inheritance

Nik Nguyen AP Computer Science Advanced Placement Englisch

Inhalt der Mindmap

Inheritance

  1. Defined as a relationship between objects that share characteristics

    • I.e. -- a new class, aka subclass, is created from an existing class (superclass) by absorbing its state and behavior.
      • The subclass INHERITS characteristics of its superclass.
    • In code, the relationship is specified in the declaration of the subclass, using the keyword "extends".
  2. Works by hierarchy

    • See the following chart:
      • Person
        • Student
          • GradStudent
          • UnderGrad
        • Employee
      • The relationship between classes is called an "is-a" relationship.
    • Subclasses can only inherit from a superclass. Subclass cannot inherit from another subclass, and a superclass cannot inherit from a subclass.
      • A subclass may inherit the public/protected variables and methods of its superclass, as well as have additional methods and instance variables not in the superclass as well.
        • Subclasses can redefine the method it inherits as well.
          • I.E. Gradstudent and undergrad may use different algorithms for computing the course grade by changing the computeGrade method inherited from Student.

Informationen

Beschreibung
A small mindmap on inheritance.
Erstellt von
Nik Nguyen · Apr 2016
Aktualisiert
28 Jul 2016
Aufrufe
129
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck