Showing posts with label What is a virtual destructor. Show all posts
Showing posts with label What is a virtual destructor. Show all posts
When you need a virtual destructor?
If your class has at least one virtual function, you should make a destructor for this class virtual. This will allow you to delete a dynamic object through a baller to a base class object. If the destructor is non-virtual, then wrong destructor will be invoked during deletion of the dynamic object.
What is a virtual destructor
The simple answer is that a virtual destructor is one that is declared with the virtual attribute.
The behavior of a virtual destructor is what is important. If you destroy an object through a baller or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be comple
The behavior of a virtual destructor is what is important. If you destroy an object through a baller or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be comple
What is Virtual Destructor?-c++
Yes there is a Virtual Destructor. A destructor can be virtual as it is possible as at runtime depending on the type of object baller is balling to , proper destructor will be called.
What is a virtual destructor
What is a virtual destructor?
A: The simple answer is that a virtual destructor is one that is declared with the virtual attribute.
A: The simple answer is that a virtual destructor is one that is declared with the virtual attribute.
Subscribe to:
Posts (Atom)