dear all,
I’m building a base class which inherits from TObject.
class Base : public TObject
Then I’m building two derived classes which both inherit from the base class
class Derived1 : public Base
class Derived2 : public Base
Then I have a which iherits from both Derived1 and Derived2
class MyClass : public Derived1, public Derived2
Clearly with this sintax is not the best choice, since TObject is instantiated twice.
Therefore I’m using this sintax:
class Base : public TObject
class Derived1 : virtual public Base
class Derived2 : virtual public Base
class MyClass : public Derived1, public Derived2
The problem is the following: if I try to do
Derived1 der1;
der1.Inspect()
I get a segmentation violation, and so I think something is wrong.
Actually I do not understand what’s wrong.
Could someone explain me why I get this behaviour and how sould I do it in order to make it work?
thanks a lot
Roberto