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
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
What is ios flag in c++?
How the delete operator differs from the delete[]operator?
What are the four partitions in which c++ compiler divides the ram?
If there are two catch statements, one for base and one for derived, which should come first?
Can comments be nested?
What is low level language in simple words?
Why do we use iterators?
What is the difference between map and hashmap in c++?
What is iomanip c++?
How did c++ start?
Why are pointers not used in c++?
What is a float in c++?
Can you please explain the difference between using macro and inline functions?
What is a memory leak c++?