composition

composition in oop

Page 1 of 1

2 Replies - 1868 Views - Last Post: 05 June 2010 - 08:56 AM Rate Topic: -----

#1 Adnan_hashwani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-June 10

composition

Posted 05 June 2010 - 07:19 AM

plz tel me about composition in Oop with exemple
Is This A Good Question/Topic? 0
  • +

Replies To: composition

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3093
  • View blog
  • Posts: 19,139
  • Joined: 14-September 07

Re: composition

Posted 05 June 2010 - 08:10 AM

First, read this.

In layman's terms it means that an object "owns" another and when the "parent" dies, the associated item dies as well. For example: A car has an engine. If the car is destroyed, the engine is destroyed. As opposed to aggregation where the child object isn't destroyed. Let's say you have a school. If the school shuts down, the teachers continue to exist/be teachers.
Was This Post Helpful? 1
  • +
  • -

#3 C++ Programmer  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 20
  • View blog
  • Posts: 548
  • Joined: 12-June 08

Re: composition

Posted 05 June 2010 - 08:56 AM

Wow, very good examples.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1