← Previous revision Revision as of 11:54, 20 October 2009
Line 6: Line 6:
In databases has-a relationships are usually represented in an [[Entity-relationship model]]. As you can see by the diagram on the right an account can have multiple characters. This shows that account has a "has-a" relationship with character.
In databases has-a relationships are usually represented in an [[Entity-relationship model]]. As you can see by the diagram on the right an account can have multiple characters. This shows that account has a "has-a" relationship with character.
-
In [[object-oriented programming]] this relationship can be represented with a [[Unified Modeling Language#Diagrams|Unified Modeling Language diagram]]. This has-a relationship is also known as composition. As you can see from the diagram on the right a car "has-a " carburetor, or a car is "composed of" a carburetor. When the diamond is coloured black it signifies composition, i.e. the object on the side closest to the diamond is made up of or contains t