Hi,
I'd like to know what the effect is when you have two fields of the same name in a superclass and subclass. Something along the lines of:
class Base
{
int x = 0;
}
class Derived extends Base
{
int x = 1;
}
If I store a reference to a Derived object in a Base reference variable called base and I do base.x I get 0.
If I store the reference in a Derived reference variable called der and I do der.x I get 1.
Are there actually two fields with name x in instances of Derived?
Thank you.
Edited by: 953012 on Mar 24, 2013 4:32 PM
Edited by: 953012 on Mar 24, 2013 4:33 PM