posted 18 years ago
yes...it will print 40.
when object is created in class "one", constructor of derived class gets called. since it is default conctr, it will default constr of it's parent class ie "Base" first without executing addValue().
in base class constr addValue() of "Derived" class(overridden version of addValue) gets called ..
here value =20....after completion of this constr of derived class gets executed where it will call again overridden version of addValue() from derived.......and the vale becomes 40..
........** addValue() method of Base class never executed...
-----
hope this helps.......