Diamond Problem

前端 未结 3 1100
有刺的猬
有刺的猬 2020-11-30 06:01

Wikipedia on the diamond problem:

\"... the diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and

3条回答
  •  孤城傲影
    2020-11-30 06:26

    Your second example is nowhere near the diamond problem because compiler has the ability to detect the available functions one level up of inheritance.

    Once the compiler gets to know that you are using same-named functions in two base classes, it will throw error: member 'foo' found in multiple base classes of different types.

提交回复
热议问题