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 will happen if when say delete this ?

Answer Posted / mms zubeir

There are two scenarios:

1. Using "delete this;" in destructor

Here the call will be a recursive call to the destructor
infinitely. So the program hangs here.

2. Using "delete this;" in other members of a class
including constructor.

In this case, the call is a sucide call since the object
tries to delete itself which is nothing but sitting in a
space and destroy that space itself. That is definitely a
memory crash.

Is This Answer Correct ?    13 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by friend class & friend function in c++?

1048


Is it legal in c++ to overload operator++ so that it decrements a value in your class?

1044


What is #include iomanip?

990


How long will it take to learn programming?

1043


What is binary search in c++?

1022


What is copy constructor? Can we make copy constructor private in c++?

1073


What language does google use?

1142


Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.

1098


Explain the operation of overloading of an assignment operator.

1164


Write about the use of the virtual destructor?

995


Do we have to use initialization list in spite of the assignment in constructors?

981


What is the most useful programming language?

1033


What is std :: flush?

1048


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

2060


What is const in c++?

1093