C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 13)
13.
Which of the following concepts provides facility of using object of one class inside another class?
Discussion:
48 comments Page 3 of 5.
AMOL said:
9 years ago
Inheritance can be know by IS A relationship.
Composition is known by HAS A relationship (its basically a code reuse).
Composition is known by HAS A relationship (its basically a code reuse).
Gelu Menumorut said:
9 years ago
The question is very inaccurate, it should have been:.
"Of the defining object of one class as a member of another class?".
Compare this with "Of using object of one class inside another class?".
Actually "using" means to have access to an instance by any mean (even as a parameter) and call it's member functions. None of the options match this trivial functionality, but "None" was provided as an option.
"Of the defining object of one class as a member of another class?".
Compare this with "Of using object of one class inside another class?".
Actually "using" means to have access to an instance by any mean (even as a parameter) and call it's member functions. None of the options match this trivial functionality, but "None" was provided as an option.
Khushbu said:
8 years ago
I think right will be inheritance as it inherits attributes and behavior of a class to another class.
Piyudh said:
6 years ago
I agree, thanks @Sunil.
Royal said:
1 decade ago
In the name "COMPOSITION" itself indicating that nature of ingredients.
So, here ingredients are objects & nature is is class.
So, here ingredients are objects & nature is is class.
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++.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers