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 happens if an exception is throws from an, object's
constructor and object's destructor?

Answer Posted / som shekhar

When an exception is thrown from the object constructor,
then the destructor of the object wont be called. But to
undone all the things that happened in the c'tor before the
exception is thrown, you can make use of smart
pointer(either boost smart pointer or std auto pointer).

when an exception is thrown from the destructor the compiler
terminates the application.

So it is advisable not to throw an exception in the
destructor , better to do "something else".

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are associate containers?

1043


Is c or c++ more useful?

1055


How the keyword struct is different from the keyword class in c++?

1043


How one would use switch in a program?

1080


What is the difference between mutex and binary semaphore?

1239


What is atoi in c++?

1078


What is protected inheritance?

1050


why is c++ called oops? Explain

1052


What are maps in c++?

967


Can I make ios apps with c++?

1055


Can we declare a base-class destructor as virtual?

1012


What are namespaces in c++?

1100


What is microsoft c++ redistributable 2013?

1109


What does new return if there is insufficient memory to make your new object?

1040


What are static member functions?

1121