But after some mock exams, I am not sure anymore. As you guess, depending of the version (Whizlabs or K&B), they dont give the same answer. Perhaps it depends of some external factor... ( circular HAS-A, etc. ) ?
Both questions where on a completely theorical situation (ClassA, ClassB, ClassC ... )
Can someone tell me if HAS-A is transitif or not ? And perhaps some exception(s) to the general rule... [ February 21, 2006: Message edited by: John Smith ]
Originally posted by Keith Lynn: No, the "has a" relationship is not transitive. Just because my class definition "has a" String instance variable, it does not mean that Object.java has a String instance variable.
To prove your example, after your conclusion, it seems to me that you imply that Object HAS-A MyClass (?!?) since to have your conclusion ( Object HAS-A String ), you should have Object HAS-A MyClass and MyClass HAS-A String
Correct me if I am wrong plz... But It is just an example anyway, if you are sure that HAS-A is NOT transitive, it will be fine for me. [ February 21, 2006: Message edited by: John Smith ]
I tend to say NO because if you say yes, this can lead to an incredible number of HAS-A relations for a class in a random application.
man HAS-A child, child HAS-A illness >>> man HAS-A illness ? No, not really. husband HAS-A wife, wife HAS-A husband >>> husband HAS-A husband ? Again, no. (I am not sure this one is in the scope of transivity)
Perhaps it is case dependent.
But most question on the subject I have encounter only put random names without any context. And give different answers [ February 22, 2006: Message edited by: John Smith ]