posted 17 years ago
Hi Manoj,
Output:
b=0
b=16
Facts to think about:
1- If method is overridden, which method to call at run time
2- Order of initialization
3- Constructor call
4- Until constructor of the the parent class completes, subclass member variables are not initialized.
5- Sub class object is created, from the parent class constructor you make call to the method that is overridden in the subclass, subclass version is selected at run time.
6- When parent class constructor runs value of "b" gets its default (0 for integer member variable) and, after that b gets its value 16 before the constructor of the subclass executes.
Think, you will get the answer
Thanks and Regards,
cmbhatt
[ April 07, 2007: Message edited by: Chandra Bhatt ]