Boost logo

Boost :

From: Miki Jovanovic (miki_at_[hidden])
Date: 2000-02-23 10:14:18


Hello all,

What is you opinion, does it make sence to have class like this?

   /*
    * abc
    *
    * Classes should inherit from this class if they are abstract base
classes.
    * abc ensures that the destructor is virtual.
    */
   class abc {
      protected:
         abc() {}
         virtual ~abc() {}
   };

The idea is sort of similar as with noncopyable. Basically, any class
that is an abstract base class should inherit from abc. abc ensures
that the destructor is virtual, which is very important for abc's. Is
there any other 'rule' that applies to abc's that can be put into a
base utility class like this.

I know that including a virtual destructor in you class is easy, but
when defining interfaces or very light classes, it is easily
overlooked, even though you are fully aware that you are designing a
abc. A class like this would be an official way to declare an abc.

I was also not sure about including the protected constructor. Should
it be included?

Cheers,

Miki Jovanovic.


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