Hi guys,
Could you please explain why option D is correct in the below question :
What statement(s) is/are true ?
a) is-a relationships always rely on inheritance.
b) is-a relationships always rely on instance variables.
c) is-a relationships always require at least two class types.
d) is-a relationships always rely on
polymorphism.
e) is-a relationships are always tightly coupled.
In my first attempt I chose A and C, but according to MasterExam explanation the correct answers are A, C and D.
I'm woundering why option D would be correct. As far as I know polymorphism applies only to instance methods, thus supposing you have a given class B that extends class A and both have the same static method called as doSomething() for example, polymorphism will not be applied when calling this method but I still have a is-a relationship.
Please let me explain by using code :
If you run the above code the output is : Message sent from within class A.
You can see that polymorphism wasn't applied here but I still have a IS-A relationship.
Can anyone please give your comments.
Thanks