Boost logo

Boost :

From: Jon Jagger (Jon.Jagger_at_[hidden])
Date: 2000-02-23 14:28:15


>Hello all,
>
>What is you opinion, does it make sence to have class like this?
>
> class abc
> {
> protected:
> abc() {}
> virtual ~abc() {}
> };

     class derived : public abc
     {
     };

     abc * ptr = new derived;
     delete ptr;

This delete expression won't compile because abc's destructor is protected.
So it doesn't really matter whether it's virtual. For what it's worth I
don't think classes like this have enough pros to outweight their cons.
I've messed about with stuff like...

     class wibble : public interface<wibble> ...

     class fubar : public abstract<fubar>...

     class snafu : public concrete<snafu>...

These are similar, quite nice, but I still don't feel their pros outweight
their cons.

Cheers
Jon Jagger


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk