I am trying to write some subclasses of classes in a big library. I am getting an "ambiguous base" error. Here is a compilable example of the problem:
#include <iostream>
// I can't change these because they are in the library:
class InteractorStyle {};
class InteractorStyleCamera : public InteractorStyle {};
class InteractorStyleImage : public InteractorStyle {};
// These are my subclasses (so I can change them):
class PointSelector : public InteractorStyle {};
class PointSelector2D : public InteractorStyleCamera, public PointSelector
{
// This function has to exist exactly like this (a requirement of the library):
static PointSelector2D* SafeDownCast(InteractorStyle *o)
{
return static_cast<PointSelector2D *>(o);
}
};
int main()
{
return 0;
}
The error is
error: ‘InteractorStyle’ is an ambiguous base of ‘PointSelector2D’.
Is there anything I can do in this case?