How do you know that your class needs a virtual destructor?
Answer Posted / abc
When We Declare a Virtual Function In Base Class.
The Base Class Pointer Can Point To Derived Class objects.
And If we Try To Delete The Base Class Pointer ,it will Call
the base Class Destructor(Which Is Wrong).
To Handle Such Scenario,The Base Class Destructor need To
Be Declared As Virtual(Which Makes All The Derived Class
Destructors Virtual).Now The Base Class Pointer Will Call
The Respective Destructors(Ofcourse,It Is Decided at Run
Time.With The Virtual Mechanism.)
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be
What is c++ library?
Do vectors start at 0?
What is setf in c++?
Do you know about C++ 11 standard?
How are Structure passing and returning implemented by the compiler?
What is const pointer and const reference?
What is pointer with example?
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
What are the rules for naming an identifier?
What is time h in c++?
Can a list of string be stored within a two dimensional array?
What is a unnitialised pointer?
How do you save a c++ program?
Do the names of parameters have to agree in the prototype, definition, and call to the function?