Showing posts with label Has-a. Show all posts
Showing posts with label Has-a. Show all posts

Thursday, May 10, 2012

Multiplicity

Multiplicity refers to the number of relationships that exists between 2 classes in a composite relationship.

In the diagram below, Player has a 1 to 1 relationship with the Sword class and the Flight class.

Composition: Has-a



"Object composition - Wikipedia, the free encyclopedia" ( http://bit.ly/K0qMRm )

"Has-a - Wikipedia, the free encyclopedia" ( http://bit.ly/JWe9mb )

Composition is a relationship between objects. When one object is composed of others, this is said to be a composite relationship.

In the class diagram below, the Player class has-a relationship with the InventoryItem class. Another was to say this is that the Player class is composed of multiple classes.