What is virtual destructor? Why?
Answers were Sorted based on User's Feedback
Answer / sagarika patra
When a destructor is declared as virtual in the base class
is known as virtul destructor.
Whenever any object of derived class of base type is freed
(using delete operator),the destructor of the derived class
is called and the memory allocated by derived class
variables are freed ,leaving the memory allocated by the
base class variables as unfreed.
Hence by declaring the base class destructor as
virtual,both the destructor will called in order.
| Is This Answer Correct ? | 9 Yes | 0 No |
Answer / mugdha taru
virtual destructor are those who can not override while
redefining derived class.
| Is This Answer Correct ? | 2 Yes | 3 No |
Answer / riya piyush jain
In object-oriented programming, a destructor (sometimes
shortened to dtor) is a method which is automatically
invoked when the object is destroyed. Its main purpose is
to clean up and to free the resources which were acquired
by the object along its life cycle and unlink it from other
objects or resources invalidating any references in the
process. The use of destructors is key to the concept of
Resource Acquisition Is Initialization.
| Is This Answer Correct ? | 4 Yes | 8 No |
Can anyone please explain runtime polymorphism with a real time example??at what ciscumstances we go for it??
What is polymorphism used for?
What is overriding in oops?
Write a C++ program to conduct an election of a mayor.Declare a class ELECTION With the following specification: Data member: Name 25 character Age Integer symbol 1 character Member functions: To accept data for 20 contestant To accept symbol as voting from 100 voters. To declare the winner and the loser.
1 Answers Global Academy, Infotech,
why the memory allocated with new cant be freed using free()
should we use linear search or binary search if elements are placed in random order or mixed?in both cases? i need a little bit detail ans?thnks
what is a binary overloading
What is DeadlyDiamondDeathProblem ?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
DIFFRENCE BETWEEN STRUCTURED PROGRAMING AND OBJCET ORIENTED PROGRAMING.
What is conditional Compilation?