¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Inheritance

Nik Nguyen AP Computer Science Advanced Placement Inglés

Contenido del mapa

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.

Información

Descripción
A small mindmap on inheritance.
Creado por
Nik Nguyen · abr 2016
Actualizado
28 jul 2016
Visitas
129
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?