|
Boost : |
From: Miki Jovanovic (miki_at_[hidden])
Date: 2000-02-23 16:31:22
"jon jagger" <jon.jagge-_at_[hidden]> wrote:
> class derived : public abc
> {
> };
>
> abc * ptr = new derived;
> delete ptr;
You are using a bad example. Try this:
class ICommand : public abc {
public:
virtual void execute() = 0;
};
class MyCommand : ICommand {
public:
virtual void execute() { /* do something */ }
};
ICommand *pCmd = new MyCommand;
delete pCmd;
In this case it is IMPERATIVE.
The only benefit of abc I really want is this: once you declare a
virtual destructor, it always stays virtual. So, if you are designing
an abstract base class, it 99% of the cases it needs a virtual
destructor. abc class should not be visible from the outside. The
derived class should only get the benefit of implicitly having a
virtual destroctor.
Cheers,
Miki.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk