Inheritance

  • Thread starter Thread starter WASTHEBEST
  • Start date Start date
W

WASTHEBEST

Classes:
-A
-AB

If AB inherits A, then is it correct you cannot do the following:
AB = A
?
 
Hi WASTHEBEST,

If I understand what you mean, no you can't do the following

A a = new A();
AB ab = new AB();

ab = a; // won't work as you can only reference children
// or interfaces of AB, or AB itself
a = ab; // works, because AB is a "child" of A
 
Back
Top