• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a true or false statement

 
adam Lui
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
palla sridhar
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes its true
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic