My blood is tested +ve for Java.
SCJP 1.4 (100%) Done.<br />SCJD (URLyBird 1.2.3 Started)
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 1.4 (100%) Done.<br />SCJD (URLyBird 1.2.3 Started)
class-based encapsulation certainly makes it easy to implement operations like clone() and equals()...
SCJP 1.4 (100%) Done.<br />SCJD (URLyBird 1.2.3 Started)
Originally posted by George Bolyuba:
Is this code breaking Encapsulation paradigm?
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
Does that help?
SCJP 1.4 (100%) Done.<br />SCJD (URLyBird 1.2.3 Started)
Originally posted by Smita Chopra:
I have read that polymorphism is about overriding but is it about overloading as well.
Thanks
Originally posted by Layne Lund:
TRUE!
So did you have an actual question, or did you visit to just tell us this fact?
Originally posted by CL Gilbert:
Overloading has nothing to do with polymorphism.
The example you gave does violate encapsulation and will bring along with it all the negative effects of that violation. Most promanently, you can't change the inside of one class without it affecting the behavior of another class.
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
There is no polymorphism involved with overloaded methods.
Originally posted by Smita Chopra:
Is the book incorrect when it says, no polymorphism with overloaded methods?
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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |