Object-Oriented Programming
An Introduction |
Prof. David Bernstein
|
Computer Science Department |
Class A is said to be associated with class B if an object in class A can send a message to an object of class B or if an object in class A can create, receive or return objects of class B.
Class A is said to depend on class B if method in an object of class A is passed an object of class B.
An object of class A is an aggregate of an object of class B if B is a part of A. It is also often called the "has a" relationship though the phrase "has a" is ambiguous (e.g., a car has a color and a car has a radiator mean very different things).
An object of class A is composed of an object of class B if B is a part of A and A controls the life of B (e.g., if A is destroyed then B will be destroyed). Thus a component can be associated with exactly one composite (making the multiplicity implictly 1).
An object of class A "is-an" object of class B if A is/does everything that B is/does and more.
Sortable
Plant.Leaf
and
Hierarchy.Leaf
)null