posted 14 years ago
Hi, Here is a piece of code and its output. Could not understand why the derived class method is called:
When we run this, the output is:
In ctr of Test1()
In Test2.d()
In ctr of Test2()
2
My questions is -
Why did Test2.d() get called from the ctr of Test1()? And if it did, then why is the value of i printed as 2 and not 5?
Please reply asap.