Write about the use of the virtual destructor?
Answer / Vinod Kumar Maurya
A virtual destructor in C++ is used when dealing with polymorphic classes (base class and derived class). It ensures that the correct destructor is called for each object, regardless of how it was created or which specific type it actually is at runtime. This is crucial to prevent memory leaks or other undefined behavior.
| Is This Answer Correct ? | 0 Yes | 0 No |
Do we have to use initialization list in spite of the assignment in constructors?
What is do..while loops structure?
give me some class & objects examples?
Can you think of a situation where your program would crash without reaching the breakball, which you set at the beginning of main()?
Why seem interrupt handlers as member functions to be impossible?
how to explain our contribution in the project?
What is the purpose of ios::basefield in the following statement?
why v use c++ even we have microprocessor
Why should we use null or zero in a program?
What is a Default constructor?
Which one is a preferred language C or C++? Why?
Can I learn c++ without learning c?