Answer Posted / neelam saini
There are three acceptable answers:- "Never," "Rarely," and "When the problem domain cannot be accurately modeled any other way."
Consider an Asset class, Building class, Vehicle class, and CompanyCar class. All company cars are vehicles. Some company cars are assets because the organizations own them. Others might be leased. Not all assets are vehicles. Money accounts are assets. Real estate holdings are assets. Some real estate holdings are buildings. Not all buildings are assets. Ad infinitum. When you diagram these relationships, it becomes apparent that multiple inheritance is a likely and intuitive way to model this common problem domain. The applicant should understand, however, that multiple inheritance, like a chainsaw, is a useful tool that has its perils, needs respect, and is best avoided except when nothing else will do.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of templates in c++?
Why is main an int?
Explain the auto storage classes in c++.
Refer to a name of class or function that is defined within a namespace?
What is the full form of stl in c++?
How can a struct in c++ differs from a struct in c?
What is the full form of c++?
Who was the creator of c++?
What is the best c++ compiler for windows 10?
What does new do in c++?
If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?
What are the comments in c++?
What is c++ mutable?
Explain what happens when a pointer is deleted twice?
What is virtual destructor ans explain its use?