Tuesday, January 22, 2013

Composition OOP

Composition
Composition means consists of many things.Mean Single big object/class consists of many objects in it.
Ex:-
@interface Computer
{
    CPU * ptrCpu;
   Monitor* ptrMonotor;
   Mouse* ptrMouse;
}
@end

Only objects are said to be composed not primitive data type like int ,char etc.

Composition set up "has a " relationship. Its represent that Main object own other small small objects.
Ex: Computer has a Cpu.

Inheritance set up "is a" relationship.
Ex:-Triangle is a shape


0 comments:

Post a Comment

About

Powered by Blogger.