Chinmay Terse wrote:If I have one class with overloaded methods, which does not extend or implement other classes or interfaces resp., won't this be a case of compile-time polymorphism without an IS-A relationship?
Yes; however, I'm an old purist who thinks that the term "compile-tiime polymorphism" is an oxymoron.
Operator overloading, OTOH - as exists in languages like C++ (and to a very limited extent in
Java) - IS polymorphic because it involves more than one class; and its mechanics are much more like overriding.
So, given the wording of the question, it's not clear whether leaving out 'D' is wrong or not. However, if you already put C, I'd say that you're bound to include D, since
method overloading can't involve two classes.
I'd also say that 'A' is arguable. For example, is the
Decorator Pattern an 'IS-A' relationship? I'd say it probably is, even though it's usually implemented as a wrapper for flexibility - and there may well be other examples due to Java's single inheritance stipulation.
Hope I haven't "muddied the waters" for you.
Winston