O'Reilly logo
  • LI WEI thinks this is interesting:

The Donkey and Horse classes, however, both inherit from the base class Mammal. We instantly have an issue! If we were to call mule.talk(), but mule does not override the talk() function, which member function should be invoked, that of Horse or Donkey? It's ambiguous.

From

Cover of Learning C++ by Creating Games with UE4

Note

多重继承的冲突,如果我们有一个骡子继承自驴子和马,这俩继承自哺乳动物。如果我们的骡子没有重载talk函数,那么我们现在调用talk的时候,到底调用的是驴子还是马的?