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...

what is virtual destructor

Answer Posted / rock

When a derived class object pointed to by a base class
pointer dynamically is deleted only the base class
destructor is invoked inorder to even invoke derived class
destructor we use virtual destructor.

class shape
{
virtual ~shape(){}
};
class circle:public shape
{
~circle(){}
};
void main()
{
shape *sh = new circle;
delete sh; //both the destructors are invoked
}

If virtual keyword is not added to the base class
destructor only the base class destructor is called.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are polymorphisms mutations?

1213


What is the significance of classes in oop?

1232


What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2596


what are the ways in which a constructors can be called?

2203


How is polymorphism achieved?

1111


Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.

1312


how to get the oracle certification? send me the answer

2205


What are the three parts of a simple empty class?

2097


Why do we use oops?

1071


explain sub-type and sub class? atleast u have differ it into 4 points?

2363


what type of question are asked in thoughtworks pair programming round ?

2267


What is the point of polymorphism?

1094


How to improve object oriented design skills?

1066


Can you explain polymorphism?

1157


What exactly is polymorphism?

1182