SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
SCJP 1.4
James Carman, President<br />Carman Consulting, Inc.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
Originally posted by Jon Lee:
When invoke son1.getName(), son1 is upcasted to the type Father because class Son does not override this method. After the upcasting, interpreter regards son1 as a reference to that subobject which contains a name field with value "father". That's why you can "father" in the second line of output.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
Originally posted by Jon Lee:
Yes mate. Your post make a lot sense to me. Thnx so much. I confuse "this" in java with the pointer in C++....
SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)