CS202 1-17
Finding Class Relationships
•Three relationships are common between classes:
•Use or awareness
•Creating/using objects of another class, passing objects of another class as arguments
•Minimize the number of these relationships
•One class should be as unaware as possible of the existance of another class! Eases future modification!
•Aggregation or containment
•“has a” relationship, a special case of usage
•One object contains another object (a rectangle has 4 points)
•Inheritance or specialization
•“is a” relationship ( a rectangle is a polygon)
•Can lead to very powerful and extensivle designs