Friday, November 17, 2006

C++ : The Object Destruction Process

A user-defined destructor is augmented in much the same way as are the constructors, except in reverse order:

1. If the object contains a vptr, it is reset to the virtual table associated with the class.

2. The body of the destructor is then executed; that is, the vptr is reset prior to evaluating the user-supplied code.

3. If the class has member class objects with destructors, these are invoked in the reverse order of their declaration.

4. If there are any immediate non-virtual base classes with destructors, these are invoked in the reverse order of their declaration.

5. If there are any virtual base classes with destructors and this class represents the most-derived class, these are invoked in the reverse order of their original construction.

4 comments:

Saransh Mittal said...

Hello sir,
i am glad that i bumped into this wonderful page that you have created for learners like me..
well i am doing my engineering in IT frim IP university in Delhi..

i would be really glad if i could learn something from you..

there is one thing that i wanna ask you and that is whether you can tell me where to find the Microsoft Visual Studio on the net. It is because i would really like to learn .NET and sor that i need the software..

also i will be having many queries which i will be asking from time to time..

thanks a lot in advance..
Saransh Mittal

Saransh Mittal said...

one thing more sir which i forgot to ask and that is whether you can provide me any good book on data structure as i am really very much interested in that topic.. i hope that you help me out..

Zaman Bakshi said...

cool_guy_saransh

You can download the express edition from www.microsoft.com, to get a good book on data structures you can visit.

1. www.flazx.com
2. www.chmpdf.com

Anonymous said...
This comment has been removed by a blog administrator.