What is virtual constructors/destructors?

What is virtual constructors/destructors?

Virtual Destructor :
- The explicit destroying of object with the use of delete operator to a base class pointer to the object is performed by the destructor of the base-class is invoked on that object.
- The above process can be simplified by declaring a virtual base class destructor.
- All the derived class destructors are made virtual in spite of having the same name as the base class destructor. In case the object in the hierarchy is destroyed explicitly by using delete operator to the base class pointer to a derived object, the appropriate destructor will be invoked.

Virtual Constructor :
A constructor of a class can not be virtual and if causes a syntax error.
When should we use container classes instead of arrays? - C++
When should we use container classes instead of arrays? - It is advisable to use container classes of the STL so that you don’t have to go through the pain of writing...
Difference between a homogeneous and a heterogeneous container
Difference between a homogeneous and a heterogeneous container - When a container class contains a group of mixed objects, the container is called a heterogeneous container....
What is a container class? What are the types of container classes?
What is a container class? What are the types of container classes? - A class is said to be a container class which is utilized for the purpose of holding objects in memory or persistent media....
Post your comment