C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 56)
56.
Which of the following provides a reuse mechanism?
Abstraction
Inheritance
Dynamic binding
Encapsulation
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
6 comments Page 1 of 1.

Codi said:   3 years ago
Thank you @Harjot.

Mau said:   5 years ago
It can acquire the properties of another class so, inheritance provides reuse mechanism.

Pranali said:   6 years ago
easy to test

Tomxie said:   8 years ago
Why not Abstraction?

Harjot said:   10 years ago
Inheritance allows the programmer to make use of the features of one class to make another sub-class. For example, 'Pigeon' reuses or inherits some features from the class 'Bird'.

Abstraction is said to be in effect when the user is provided with only the useful information, hiding the rest. For instance, a user doesn't need to know how the class 'Pigeon' is stored in the memory - all s/he cares about it how different is 'Pigeon' from 'Peacock'.

Encapsulation allows us to wrap data and functions that will use that data, into a single unit such as a Class. A class for creating a 'Bird' would have all the data and the functions related to this class.

Polymorphism is the property by which any entity can behave differently when a different message is passed to them. One set of parameters in the class 'Bird' can you a 'Pigeon', another can give you a 'Peacock'.

Harish said:   1 decade ago
Through inheritance, we can acquire the properties of the parent class. Thus we can reuse the methods and variables of the parent class.

Post your comments here:

Your comments will be displayed after verification.