Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how to access grid view row?

2241


Does a derived class inherit or doesn't inherit?

1093


What is the array and initializing arrays in c++?

1031


What it is and how it might be called (2 methods).

1186


What do you mean by function and operator overloading in c++?

1054


Describe the setting up of my member functions to avoid overriding by the derived class?

1137


Why c++ is better than c language?

1020


List different attributes in C++?

1099


What is conditions when using boolean operators?

1236


Difference between Abstraction and encapsulation in C++?

1162


How many ways can a variable be initialized into in C++?

1026


What is the full form of india?

1131


How do you instruct your compiler to print the contents of the intermediate file showing the effects of the preprocessor?

1150


why is iostream::eof inside a loop condition considered wrong?

1061


Write a program to find the reverse Fibonacci series starting from N.

1275