A has-a relationship can be established by using ojbect reference variables a as local variables.
true or false. Why? [ October 19, 2007: Message edited by: adam lui ]
posted 8 years ago
Hi Adam! It was a nice question to ask. As far as i know, if a class contains object reference variable as instance variable, then that's a HAS-A relatinship. For example: means Animal HAS-A Dog.
If you also check K&B, there is also an example like this:. The book says that
Users of a Horse should not even need to know that there is such a thing as a Halter class.
So if you go by this explantion, users of a class dont even need to know that there is a local object reference variable, which implies that local object reference variables also follow HAS-A relationship.
So my answer is TRUE and for why? above is the explanation.. This is what i think, anybody please correct me if i'm wrong!!
Thanks and Regards,
*Nothing is CONSTANT in life, except CHANGE*