
13 Jan
2005
13 Jan
'05
12:45 p.m.
Jonathan Wakely skrev:
On Thu, Jan 13, 2005 at 12:49:33PM +1000, kalin wrote:
This is a simpler way of preventing inheritance:
class Finaliser { protected: Finaliser(){} };
class Final : private virtual Finaliser { // rest of class as normal };
[...] There's another problem with Final that lets you derive from it in a class with user-defined constructors, if you know how. Our wiki where I work offers a chocolate bar to anyone who points it out but noone's claimed it from me yet :)
class WillCompile : public Final, virtual Finaliser { public: WillCompile() {} }; Will you mail the chocolate bar to me then? Daniel