Boost logo

Boost Users :

From: Darin Adler (darin_at_[hidden])
Date: 2002-06-05 12:49:53


On Wednesday, June 5, 2002, at 09:30 AM, Bobby Thomale wrote:

> class MyBase : private boost::noncopyable {
> public:
> MyBase ();
> virtual ~MyBase ();
> };
>
> class A : public MyBase {
> public:
> A ();
> virtual ~A();
> };
>
> Does this do what I would expect, ie whether I delete a MyBase* or an
> A*, it
> calls the destructors for both A and MyBase like it is supposed to?

All three destructors get called. Loosely speaking, ~MyBase calls
~noncopyable.

The only time that the non-virtual destructor in noncopyable would
matter is if you deleted an object of class A using a noncopyable*, but
that's not going to happen.

     -- Darin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net