2006-11-03 | Final Class in CPP
#define FINALCLASS( X ) /
class FinalBase##X/
{ /
friend class X; /
private: /
FinalBase##X(){}; /
virtual ~FinalBase##X(){}; /
}; /
class X : virtual private FinalBase##X
FINALCLASS(FinalClass)
{
friend class TestClass;
};
class TestClass : public FinalClass
{
};
2006-11-03 | Final Class 2 in CPP
class Final
{
protected:
Final(){};
virtual ~Final(){};
};
class FinalBase : virtual protected Final
{
};
class FinalClass : private FinalBase
{
// friend class TestClass : this is will destroy the final class.
}
class TestClass : public FinalClass
{
};