class Temp { private: ~Temp() {} friend class Final; }; class Final : virtual public Temp { public: void fun() { cout<<\"In base\";
And of course the proper way to do it today is to use the final keyword. For example:
class Foo final { public: Foo() {} ~Foo() {} void bar() { // ... } };