|
Boost : |
From: Daniel Wesslén (wesslen_at_[hidden])
Date: 2005-01-13 07:45:59
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk