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

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 ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a constructor and how is it called?

1035


State the difference between delete and delete[].

1096


why is c++ called oops? Explain

1028


How would you use the functions memcpy(), memset(), memmove()?

1082


What is the use of :: operator in c++?

1110


What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero

1084


What is protected inheritance?

1036


What are the implicit member functions of class?

1080


What is abstraction in c++?

1334


What is void pointer in c++ with example?

1078


Define 'std'.

1166


Explain what is oop?

1058


Is c++ the most powerful language?

1064


What is an orthogonal base class in c++?

1151


Explain selection sorting. Also write an example.

1020