Tải bản đầy đủ (.pdf) (11 trang)

Software design: Lecture 18 - Sheraz Pervaiz

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (282.34 KB, 11 trang )

1

Software Design

Lecture : 18


2

Relationships between Classes

Ø

Association –Discussed in Previous  Lecture

Ø

Aggregation

Ø

Composition

Ø

Inheritance


3

Aggregation or “ has –a “ 


relationship
Ø

Specialized form of association i­e Weak 
Association.

Ø

Assembling a class from other classes.

Ø

Aggregation is a special type of relationship used 


4

Aggregation
Ø

In  an  aggregation  relationship,  the  child  class 
instance can outlive its parent class.

Ø

Child  class  can  be  a  part  of  multiple  parent 
classes.

Ø


To  represent  an  aggregation  relationship,  you 


5

Example


6

Aggregation Example


7

Example


8


9

Example – Aggregation and 
Multiplicity


10

Composition – Container and Contained classes


Ø

It’s a strong association. 

Ø

It contain Objects that live and die together.

Ø

The  composition  aggregation  relationship  is  just 
another form of the aggregation relationship, but 


11

Composition Continues....
Ø

Another  important  feature  of  composition 
aggregation  is  that  the  part  class  can  only  be 
related to one instance of the parent class



×