From MasterExam:
Which statements are true? (Choose all that apply)
A
. is-a relationship always rely on inheritance
B
. is-a relationship always rely on instance variables
C
. is-a relationship always require at least two class types
D
. is-a relationship always rely on polymorphism
E
. is-a relationship are always tightly coupled
Correct answers: A, C, D
I don't see how any of A, C or D are correct.
An Object object IS-A Object. A String object IS-A String. There is only one class type in each of these statements and no inheritance or polymorphism applies.
Is my rationale wrong or are the answers incorrect?
Your rationale is slightly off, as this relationship applies to classes, not to objects.
A string IS-A object since String
inherits from Object
. Similarly a FileOutputStream
IS-A OutputStream
IS-A Object
.
IS-A is a relationship between classes, no between classes and objects.