J
jrwats
Ultimately I want to know if there is a workaround or clever trick to
accomplish:
temlpate<class T>
class A
{
friend class T;
private:
//functions...
};
class B : class A<B>
{
};
But... what got me to this point was the following - so if you can
accomplish the below I'll be 90% satisfied:
The non-template pattern:
class NoInheritBaseEx
{
private:
friend class NoInheritBaseImpl;
NoInheritBaseEx(){ }
};
// No class can inherit from NoInheritBaseImpl... well they can, but
// they cannot be instantiated because of the private constructor.
class NoInheritBaseImpl :
virtual NoInheritBaseEx
{
};
I want to be able to do:
template<class T>
class NoInheritBaseEx
{
private:
friend class T;
NoInheritBaseEx(){}
};
class NoInheritBasImpl :
virtual NoInheritBaseEx<NoInheritBaseImpl>
{
};
accomplish:
temlpate<class T>
class A
{
friend class T;
private:
//functions...
};
class B : class A<B>
{
};
But... what got me to this point was the following - so if you can
accomplish the below I'll be 90% satisfied:
The non-template pattern:
class NoInheritBaseEx
{
private:
friend class NoInheritBaseImpl;
NoInheritBaseEx(){ }
};
// No class can inherit from NoInheritBaseImpl... well they can, but
// they cannot be instantiated because of the private constructor.
class NoInheritBaseImpl :
virtual NoInheritBaseEx
{
};
I want to be able to do:
template<class T>
class NoInheritBaseEx
{
private:
friend class T;
NoInheritBaseEx(){}
};
class NoInheritBasImpl :
virtual NoInheritBaseEx<NoInheritBaseImpl>
{
};