C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 13)
Which of the following concepts provides facility of using object of one class inside another class?
Discussion:48 comments Page 1 of 5.
Dipanjan Saha said: 1 decade ago
What is composition in c++?
Gayathiri said: 1 decade ago
Can anyone explain whats meant by composition in c++?
Suman.k said: 1 decade ago
The process of building complex objects from simple ones is called composition.
Neha katariya said: 1 decade ago
In real-life, complex objects are often built from smaller, simpler objects. For example, a car is built using a metal frame, an engine, some tires, a transmission, a steering wheel, and a large number of other parts. A personal computer is built from a CPU, a motherboard, some memory, etc.. Even you are built from smaller parts: you have a head, a body, some legs, arms, and so on. This process of building complex objects from simpler ones is called composition
Abhinav said: 1 decade ago
But this is what the whole concept of Object Oriented Programming. But Question said a feature of OOPS is Composition, I have learned only four of them, and composition is not one of them.
RAHUL said: 1 decade ago
We don't have composition so please can anyone tell what do you mean by composition in c++.
Kapil Patidar said: 1 decade ago
Here we are talking about object, not class, so don't relate this with inheritance. So 'composition' is related to the object and 'inheritance' is related to classes so the answer here will be COMPOSITION. Thank you.
Madhavikalyanapu said: 1 decade ago
What the main difference of composition and inheritence?
Shubha said: 1 decade ago
Inheritance means deriving features of base class to sub-class.. where as composition means deriving a complex object from a simpler object..
Phaneendhra said: 1 decade ago
Inheritance will acquire one class properties, but here the question is not about the class, it's about an object inside a class, so the answer is composition.
Post your comments here: