Hi
I'm fairly new to c++ and I have a question regarding inheritance. I'm
trying to create a class based on 2 inherited classes, e.g.
class A
{
...
}
class B: public A
{
...
}
class C: public B
{
...
}
The problem I'm having is how to ensure I have only 1 instance of class
A, as at the moment I have 2 calls to the constructor/destructor of A
for 1 instance of C. Will virtual inheritance solve this? I have tried
class A
{
...
}
class B: virtual public A
{
...
}
class C: public B
{
...
}
without success.
Thanks