I did read from tutorial (might be Baldwin's) and I remember that only run time polyporphism (overriding) is polymorphism. But I donot agree with that since the polymorphism (having many forms) is implemented using both overloading and overriding.
Maha, I'm playing devil's advocate again : Both overloading and overriding are considered to be examples of polymorphism: 1. Overloading sometimes is called shallow kind,resolved by the compiler 2. Overriding is a deep (or true) polymorphism , resolved at runtime... Sorry.. I wish I had more time now to visit this site more often, it's a joy and a challenge! [This message has been edited by Jane Rozen (edited April 07, 2000).]
Joined: Jan 31, 2000
Jane, I used to refer to Thinking in Java for any such issues. In this, in chapter 7. Ploymorphism , 3rd paragaraph, Bruce Eckel, says This ability is critical because it allows many types (derived from the same base type) to be treated as if they were one type, and a single piece of code to work on all those diff types equally. And also throughout this chapter he talks about the late-binding of methods depending upon the type of the object, gives the classic base class 'shape' , derived classes 'Circle', 'Rectangle' etc. He also mentions at page 221 3rd paragraph, that This doesn't appear as polymorphic call at all where the example given was overloaded instead of overriden and he says that this is not what we wanted. regds maha anna
Joined: Feb 12, 2000
Maha,sure neither of us makes up this stuff! I referred to "Just Java" and "Core Java" - in both there are references to "true" as opposed to "limited" polymorphism. As long as we all know what we are talking about...
Let me check this dusty old tome I have on my desk here... <blockquote>Remember the method overriding, and keep it holy. For that is the one true polymorphism, and thou shalt hold no other polymorphism before it.</blockquote> I can't make out the author - it appears to have been assembled from postings by a number of different authors, and often appears to give conflicting info. But a lot of people seem to take it seriously for some reason.
Seriously, I personally would have answered D only, but I guess a case can be made for C, depending on how exactly one defines "polymorphism". Perhaps this question would work better as "choose the 1 best answer" - we all agree that's D right?
[This message has been edited by Jim Yingst (edited April 08, 2000).]
Jim you vote for c or d? You said if you had to choose one best answer you will pick c(overloading).So, you think overloading is the best example for polymorphism. Thanks.
Joined: Jan 30, 2000
Sorry Sree- that was a typo when I said C, which now is fixed. So now people will look at your post and wonder what you're talking about. But for the record - there was originally a good reason why he posted that question.