Mindmap
Ch 6: Inheritance

Mind map: inheritance in OOP
Inhalt der Mindmap
Ch 6: Inheritance
The process of extending a class in OOP
The 'extends' Keyword
- used to extend a class in the class declaration, after class name but before parent class
The 'is-a' Relationship
- Special relationship that is formed between the subclass and superclass when you create a new class with inheritance
- subclass is special type of superclass
- subclass inherits all public methods and fields of its superclass
- Accessibility
- can access superclass's public and protected methods & fields, but not private methods
- Accessibility
- Special relationship that is formed between the subclass and superclass when you create a new class with inheritance
Method Overriding
- changing the behavior of a method in the parent class
- done by writing a method in the subclass that has the same signature as a method in the parent class
- can override superclass's public & protected methods; cannot override final methods
- 'method overloading' refers to creating a method with the same name but different list of arguments
- done by writing a method in the subclass that has the same signature as a method in the parent class
- changing the behavior of a method in the parent class
Calling Superclass's Constructors
- When creating a child object, all its parent classes are also instantiated
- the keyword 'super' represents an instance of the direct superclass of the current object
- When creating a child object, all its parent classes are also instantiated
Calling the Superclass's Hidden Members
- 'super' keyword can be used to call a hidden member or an overridden method in superclass
- can access any member in the superclass that is visible to subclass
- 'super' keyword can be used to call a hidden member or an overridden method in superclass
Type Casting
- can only cast an instance of a subclass to its parent class
- Upcasting
- assign object of type subclass to a reference variable of type superclass
- can only cast an instance of a subclass to its parent class
Final Classes
- by using keyword 'final' in class declaration, you can prevent others from extending your class
'instanceOf' Keyword
- can be used to test if an object is of a specified type
Informationen
- Beschreibung
- Mindmap am Ch 6: Inheritance, erstellt von Samantha Sullivan am 21/11/2019.
- Erstellt von
- Samantha Sullivan
- Aufrufe
- 6
- Bewertung