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 / hitout

There are different cases to this
1) If the memory is allocated in stack, delete this should
not be called since it calls destructor twice.
2) delete this can be called in all functions except
destructor if the memory is allocated on heap(ie if new
operator is used and the object is not explicitly deleted).

3) Delete this in destructor will always cause an infinite loop.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is virtual base class?

1128


Explain binary search.

1035


Is there a c++ certification?

1100


When does a 'this' pointer get created?

1145


What is array in c++ pdf?

1280


How to declaring variables in c++?

1205


What are vectors used for in c++?

1139


What is the best c++ book?

1325


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

1187


What are pointers used for c++?

1099


Can union be self referenced?

1215


Can user-defined object be declared as static data member of another class?

1069


What is ctime c++?

1168


Is it possible for a member function to delete the pointer, named this?

1237


What is friend class in c++ with example?

1110