Answer Posted / munendra kumar
There are three acceptable answers: "Never," "Rarely," and "When the problem domain cannot be accurately modeled any other way."
There are some famous C++ pundits and luminaries who disagree with that third answer, but I will accept it.
Let's digress to consider this issue lest your interview turn into a religious debate. 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
Is ca high or low level language?
List the features of oops in c++?
Do the parentheses after the type name make a difference with new?
Write a Program for find and replace a character in a string.
Incase of a function declaration, what is extern means?
What does #define mean in c++?
Why do we use double in c++?
How c functions prevents rework and therefore saves the programers time as wel as length of the code ?
What is the use of endl in c++ give an example?
What is function prototyping? What are its advantages?
Explain friend class?
When do we use copy constructors?
What is c++ try block?
Which format specifier is used for printing a pointer value?
What is the most powerful coding language?