Mapa mental
Inheritance
Conteúdo do mapa
Inheritance
Relationship between classes
- Parent
- Other names
- Superclass
- Base Class
- Other names
- Child
- Other names
- Subclass
- Derived class
- Can access the parents methods and fields that are...
- Can overwrite the parents methods and fields that are...
- Other names
- Child inherits the methods of the parent
- Child can add functionality that doesn't exist in the parent
- The parent class' constructor is called when the child class is initialized, the parent class's parent is called, etc.
- Parent
Keywords
- extends
- Used to extend a class
- All Java classes automatically extend the java.lang.object class
- super
- Represents an instance of the direct parent class
- The child class can use to call the parent class' overwritten or hidden members
- final
- Prevents a class from being extended
- instanceof
- Used to determine if an object is of a specified type
- extends
The behavior of the child class can be changed to address needs that the parent class does not (overwriting)
A child class can only extend one direct parent class
The child and parent have an "is a" relationship: the child "is a" version of the parent
Accessibility
- public
- protected
- default (only if the same package)
Child classes can be "upcast": defined as the parent class' type
Informações
- Descrição
- Mapa Mental sobre Inheritance, criado por Vincente Squitiro em 02-08-2019.
- Criado por
- Vincente Squitiro
- Visualizações
- 0
- Avaliação