Friday, July 29, 2011

Composition, Aggregation and Inheritance

Composition: A object owns B object. such as University composition of Department objects

Aggregation: A object has B object. A is an Aggregation of B. such as Department has Professor objects, and those professor exist outside the department, they maybe a member of another Department.
           class A contains references to a class B whose instances exist and are accessible outside of A. We say A is an aggregation of B

Inheritance: A object is B object. such as a professor is a person. A is an extension of B
            when a class A includes all the members of a class B, we say that A is an extension of B, and that it inherits all the properties of B.

No comments: