Suppose I have the following declaration:
class Over1
{
protected:
class Under1
{
};
};
I know that I could do the following:
class Over2 : public Over1
{
protected:
class Under2 : public Under1
{
};
};
But is there a way to declare Under2 without Over2?
Since you would have to extend Over1 to use any derivative of Under1 this may seem silly, but in this situation there might be 30 different flavors of Under. I can either:
- Put them all inside Over1 : Not attractive since Over2 may only use 1 or 2 of them
- Put them each in their own version of Over : Not attractive since then you will have to multiply inherit from almost the same class.
- Find a way to create children of Under1 without creating children of Over1
So is this possible?
Thanks.