Joseph Arnold wrote:Remember that functions in the sub class will be executed only after the super class constructor has finished executing .
Joseph Arnold wrote:At that time only the memory is allocated for i but the value is not assigned yet
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote
3) After completion of super class' constructor, and before continuing with sub class' constructor, variables are initialized with actual values
ayush raj wrote:I mean before sub class constructor executes , are they initialized with the given values ?
ayush raj wrote:Is it always that the variables are initialized in this way ?
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
MySQL Blog
http://mysqlearner.blogspot.com/
Helen Ma wrote:I think step 1 and step 2 are in a reverse order. I think after a super class contructor is called and finishes, the class variable of the sub class are initialized to default values or their specific values.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Pinki Roy wrote:
Anayonkar Shivalkar In given code, even before super class' constructor is called, sub class' variables are initialized with [i wrote:default [/i]value.
Helen Ma wrote:Therefore, I think the super class's contructors are called before the sub classes's variables are initialized with default values or specific values.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Helen Ma wrote:The very strange thing to me is that MySub object is full instantiated in step 7, but its disp() can be called in step 4.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|