posted 24 years ago
Hello everyone,
This is from jtips.net, mock exam no. 1
The output is:
sub.methodA() = 1
sup.methodA() = 0
sup1.methodA() = 10
I don't understand why process(sup1) leads to an output of zero.
sup1 is an object of Subclass, and x in Subclass is 1! I am obviously confused about the rules about upcasting. Can you help me?