Viewport and ComponentListener

I'm inheriting from Viewport to add some additional functionality.  All is well, looks good.

Now I need to find out when certain components are resized so my Viewport-derived class can react accordingly, so I also inherit from ComponentListener with the plan on making calls to addComponentListener() for the components being watched.

But this doesn't compile, because it turns out Viewport also inherits from ComponentListener:

error: direct base 'juce::ComponentListener' inaccessible in 'MyTestClass' due to ambiguity
class MyTestClass : public Viewport, public ComponentListener

If Viewport did public or protected inheritence instead of private, then classes that derive from Viewport would have access to it.  Is there another another solution I'm not thinking about?

This simple line fixes your error:

class AmbiguousComponentListenerWorkaround : public ComponentListener {};

and then simply derive your class from AmbiguousComponentListenerWorkaround. To access your own component listener (and not the Viewport's one) make sure to cast your class to AmbiguousComponentListenerWorkaround before using it.