Inheritance Flashcards

1
Q

Inheritance:

A

a mechanism for enhancing and extending existing, working classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What can you do in a subclass?

A
Uses inherited class methods
Add new class members
Methods
Constructors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly