Похожие чаты

Hi there, Do you have any idea, How to solve diamond problem, which

implementation is separate ?

IBase
+ virtual foo() = 0
+ virtual bar() = 0

CBase1 : IBase
+ foo() override

CBase2 : IBase
+ bar() override

CDerived : virtual CBase1,virtual CBase2

3 ответов

18 просмотров

Is this the solution you're looking for? struct IBase { virtual void foo() = 0; virtual void bar() = 0; }; struct CBase1 : virtual IBase { void foo() override {} }; struct CBase2 : virtual IBase { void bar() override {} }; struct CDerived : CBase1, CBase2 { };

https://godbolt.org/z/364h9z MSVC, Clang and GCC disagree and compile this just fine

olli
https://godbolt.org/z/364h9z MSVC, Clang and GCC d...

ahh sorry, didnt notice the virtual keyword, taking my words back, :P

Похожие вопросы

Обсуждают сегодня

Карта сайта