Inheritance 03 Flashcards

1
Q

What is the substitution principle?

A

The substitution principle states that you can always use
a subclass object where a superclass object is
expected
Once substituted your superclass now holds and object reference to the subclass. But can’t call specialised methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is difference between upcasting and downcasting?

A

Upcasting is automatic, whereas downcasting requires a

manual cast

How well did you know this?
1
Not at all
2
3
4
5
Perfectly