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
For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, int pos) Assuming t

when a class is defined the compiler will not allocate memory. This is true only for data member not for member function.  As soon as the member function is defined  the require

Both malloc & new functions are utilized for dynamic memory allocations & the basic difference is: malloc need a special "typecasting" while it allocates memory for eg. if the poin

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu


Problem : (a) Stacks can be implemented using arrays. Write down the following C or C++ function to (i) create a stack (ii) add an element to a stack (push). (b) Expl

Write a simple program in C++ to investigate the safety of its enumeration types. Include at least 10 different operations on enumeration types that are incorrect/unsafe things to

A skilled programmer is required to build a standalone module to extract, parse and store in database tables, word count data from web pages and RSS feeds. The module will take

A: The simplest way is to use a stringstream: #include #include #include using namespace std; string itos(int i) // convert int to string { stringstream s;

Write a program in C to implement a FTP client that can interoperate with a default FTP server . The client should implement basic FTP commands GET PUT LIST DELE . GET -> to