Stack Overflow Asked by thorolin on December 9, 2021
Let’s say I have the following situation
// in library
class A {
void foo();
}
class B: public A {}
// own program
class MyBaseClass: public A {}
class MyTypicalClass: public MyBaseClass {}
class SpecialCaseClass: public virtual MyBaseClass, public virtual B {}
Usually I don’t need features defined in B
and it comes with some overhead I want to avoid in MyTypicalClass
. For the SpecialCaseClass
I want properties defined in MyBaseClass
and in B
. I get the error: error: request for member ‘foo’ is ambiguous, because I inherit from A
twice. Is there an elegant way I can take everything ambiguous from B
‘s A
instead of the A
of MyBaseClass
?
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP