posted 18 years ago
Hi Paulo,
when ever you are trying to access like that it will be like that.
what i mean is:
Here u have created an object for class B, and if u call overriding method, or if u call the variable or if u call the static method, it will call the derived class things, other wise if u assaign the reference of derived class to the reference of a base class, and trying to access, then it will call the derived class method, and the base class variable and base class static method.
for variables, it will always looks for the reference it is pointing to, and for methods it will always looks for the kind of object it is looking for. so u got the result like that. u cant override static methods, u can simply hide them, so it always looks for the reference type pointing to.
i think u got my point.
sri.