Inheritance Flashcards
1
Q
Inheritance:
A
a mechanism for enhancing and extending existing, working classes.
2
Q
Why do we use Inheritance?
A
- Inheritance allows us to have the one class (known as subclass) inherit the properties of another class (superclass).
- Reduces redundancy of overall code by allowing us to reuse code.
3
Q
What can you do in a subclass?
A
Uses inherited class methods Add new class members Methods Constructors
4
Q
When does overriding happen?
A
- When you implement a method in a subclass with the same signature
- The same return type as a method in its superclass.