5 Jun
2002
5 Jun
'02
5:49 p.m.
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