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
Explain what is class definition in c++ ?
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)
What are static and dynamic type checking?
What is difference between malloc()/free() and new/delete?
What is difference between class and function?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
What is static in c++?
How do you clear a map in c++?
Is arr and &arr are same expression for an array?
Which c++ operator cannot overload?
What is the type of 'this' pointer?
What is array in c++ example?
How we can differentiate between a pre and post increment operators during overloading?
How many standards of c++ are there?
Name the debugging methods that are used to solve problems?