I have no experience in C++, and I come from a Java background. Lately, I was asked in an interview on why Java would not allow multiple inheritence and the answer was pretty easy. However, I am still curious on how C++ deals with that since it allows you to inherit from more than one class.
Specifically, say there is a class called MechanicalEngineer and another called ElectricalEngineer. Both have a method called buildRobot().
What happens if we make a third class RoboticsEngineer, that inherets from both and does not override that method, and you just call:
(some instance of RoboticsEngineer).buildRobot()
Will an exception be thrown, or the method from one of the super-classes will be used? If so, how does the compiler know which class to use?