[vtk-developers] Multiple inheritance in an InteractorStyle subclass

David Doria daviddoria at gmail.com
Thu Aug 25 16:54:37 EDT 2011


I want to have this setup:

Superclass:
PointSelectionStyle - derives from vtkInteractorStyle, defines some virtual
functions like AddPoint, DeletePoint, etc

Subclasses:
PointSelectionStyle2D - derives from vtkInteractorStyleImage
and PointSelectionStyle
PointSelectionStyle3D - derives from vtkInteractorStyleTrackballCamera
and PointSelectionStyle

The problem is here:

class PointSelectionStyle2D : public vtkInteractorStyleImage, public
PointSelectionStyle
{
  public:
    static PointSelectionStyle2D* New();
    vtkTypeMacro(PointSelectionStyle2D, vtkInteractorStyleImage);

on the vtkTypeMacro line, I get:

PointSelectionStyle2D.h:37:5: error: ‘vtkObjectBase’ is an ambiguous base of
‘PointSelectionStyle2D’

After some Googling, it seems like I need to use virtual inheritance:

class PointSelectionStyle : virtual public vtkInteractorStyle

but I guess the problem is that vtkInteractorStyleImage does not virtually
inherit vtkInteractorStyle as well? Is there anything that can be done here?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110825/00668273/attachment.html>


More information about the vtk-developers mailing list