Explain virtual destructor?
Answer / Navneet Sahu
A virtual destructor in C++ ensures that the correct destructor is called when a derived class object is destroyed, even if it's done through a base class pointer. This is important because the destructors of base and derived classes may have dependencies on each other. By declaring the destructor as virtual, the appropriate destructor for the derived class will be called during destruction.
| Is This Answer Correct ? | 0 Yes | 0 No |
Write is a binary search tree? Write an algo and tell complexity?
How should a contructor handle a failure?
Can circle be called an ellipse?
why v use c++ even we have microprocessor
State the difference between delete and delete[].
What is lvalue?
State two differences between C and C++.
I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.
founder of c++
7 Answers Microtek, TCS, TeleCommand,
Which format specifier is used for printing a pointer value?
What is one dimensional array in c++?
What is the best ide for c++?