Virtual destructor, C/C++ Programming

What is Virtual Destructor? Describe it.

Posted Date: 2/13/2013 1:22:36 AM | Location : United States





Virtual Destructor:

By using virtual destructors, you can destroy objects without knowing their type - the correct destructor for the object is invoked by using the virtual function mechanism.

Note that destructors can as well be declared as pure virtual functions for abstract classes. Whether someone will derive from your class, and if someone will state "new Derived", in which "Derived" is derived from your class, and if someone will say delete p, where the actual object''s type is "Derived" but the pointer p''s type is your class.

Posted by Aana | Posted Date: 2/13/2013 1:23:51 AM


Related Discussions:- Virtual destructor, Assignment Help, Ask Question on Virtual destructor, Get Answer, Expert's Help, Virtual destructor Discussions

Write discussion on Virtual destructor
Your posts are moderated
Related Questions
Define Four Facilities Provided by C Language Preprocessor? The C language preprocessor provides four separate facilities that you can use as you see fit:   Inclusion

#quGiven the Array class definition in Fig. 11.10-11.11 (pp. 476-479) of the textbook, write a new overloaded operator function for the ‘%’ (modulus) operator (i.e., return an arra

how to write c code to solve assignment problem?

Unions A union is also like a structure, except that only single variable in the union is stored in the allocated memory at a time. It is a collection of mutually exclusive var

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

We are now quite happy to use the basic mathematical expressions, however in engineering we use scientific functions i.e Sin , Cos  , ln etc . Within C we have the following functi


C and C++ require explicit dynamic memory management, using new and delete or malloc() and free(). It is helpful to understand where variables exist (usually the stack or the he

Friend classes are used when two or more classes are designed to work together and require access to each other's execution in ways that the rest of the world shouldn't be permitte

minimum total number of shelves.