composition in oop n.
Skip this Video
Loading SlideShow in 5 Seconds..
Composition in Object-Oriented Programming (OOP) PowerPoint Presentation
Download Presentation
Composition in Object-Oriented Programming (OOP)

Loading in 2 Seconds...

play fullscreen
1 / 7

Composition in Object-Oriented Programming (OOP) - PowerPoint PPT Presentation

  • Uploaded on

This Give you a Short and Easy Concept of Composition ..What is Composition ? how it is used? what are its Examples..nHope you ppl understand.. If someone has Any Question Regarding this May ask through email or comment..nThank you!

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

Composition in Object-Oriented Programming (OOP)

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
composition in oop

Composition in OOP

Presented by Huba Akhtar

lets suppose
Lets Suppose:

Let's say we must manage rooms in a hotel. We will have a class Hotel that has several objects Floor. And each floor is composed of several Rooms.Using "is composed" give us a hint on the relationship between Floor and Room. 


If we happen to destroy the object Floor, what should happen to the Rooms??

If a Floor is destroy then all the Rooms inside should also be destroy. That is a composition


For Example, you could have a class called Band. The data member of Band class could consist of objects from the Guitarist, Drummer, and Vocalist classes. These objects are data member of the Band class, but not the parent classes. They are related by composition, not by inheritance.