Aggregation
Aggregation
When an object has a another object, then you have got an aggregation
between them.
Direction between them specified which object contains the other object.
Example:
Composition
When an object contains the other object, if the contained object cannot
exist without the existence of container object, then it is called
composition.
Also called "death relationship”
#include<conio.h>
class A
public:
char *name;
int id;
name=na;
id=n;
};
class B
private:
A *ab;
public:
int clas;
char *section;
clas=cl;
section=sec;
ab=tem;
}
void put()
cout<<clas;
cout<<section;
cout<<ab->name;
cout<<ab->id;
};
void main()
clrscr();
A a("BSSE",123);
B b(345,"B",&a);
b.put();
getch();