class Temp
{
private:
~Temp() {}
friend class Final;
};
class Final : virtual public Temp
{
public:
void fun()
{
cout<<\"In base\";
Curiously recurring template pattern. Use private inheritence.
template< typename T > class Final
{
protected:
Final() {}
Final( Final const& ) {}
};
class X : private virtual Final
{
// whatever I want to do
};
and you should find it impossible to derive anything from X because the virtual inheritence means that the most-derived class must construct the base class but it won't have any access to it.
(I haven't tested this code).