Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Definition HAS-A

 
Juan Manuel Alberto de los Santos
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain me this definition in simple code ?

Has-a relationships can be represented by using
reference variables as instance variables.
 
Bob Ruth
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kinda simple example but it expresses the point:



The Bird "has" one beak and two wings. the reference variables myBeak and myWings are instance variables that are also references to other objects. In that case we say that Object A "has" the other objects.
 
Raphael Rabadan
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, just see the code, i think u'll understand :-)



EDIT: Sorry, posted at same time.
[ July 29, 2008: Message edited by: Raphael Rabadan ]
 
Juan Manuel Alberto de los Santos
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
understood

thanks !
[ July 29, 2008: Message edited by: Juan Manuel Alberto de los Santos ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic