Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: delete an i...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 7 Topic 9555 of 9807
Post > Topic >>

Re: delete an inherited class

by Alexey Stepanyan <alexeystepanyan@[EMAIL PROTECTED] > Apr 27, 2008 at 03:47 PM

1) I believe that
class square : public shape
{
  ~square()
}

should be instead of
class square : class shape
{
  ~square()

}

2) The destructor in base class is not virtual so
    the base class destructor is called not the derived class
destructor

3) There is not a single virtual function in the base class
    so using dynamic cast has no sense. A simple static cast will be
enough.

You should declare destructor virtual in the base class.

Thanks,
Alexey.

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 7 Posts in Topic:
delete an inherited class
Free0017@[EMAIL PROTECTED  2008-04-27 12:39:04 
Re: delete an inherited class
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-27 15:43:41 
Re: delete an inherited class
Pavel Minaev <int19h@[  2008-04-27 15:46:19 
Re: delete an inherited class
alasham.said@[EMAIL PROTE  2008-04-27 15:46:32 
Re: delete an inherited class
=?UTF-8?B?RXJpayBXaWtzdHL  2008-04-27 15:48:23 
Re: delete an inherited class
Alexey Stepanyan <alex  2008-04-27 15:47:48 
Re: delete an inherited class
Vaclav Haisman <v.hais  2008-04-28 02:13:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 19 20:02:57 CDT 2008.