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 is a float in c++?

1026


Define a constructor - what it is and how it might be called (2 methods)?

1224


What is the difference between global int and static int declaration?

1150


Write about the retrieval of n number of objects during the process of delete[]p?

1061


What is insertion sorting?

1161


What is a volatile variable in c++?

1566


Is oops and c++ same?

1092


What is the difference between the functions rand(), random(), srand() and randomize()?

1355


Is it possible to provide special behavior for one instance of a template but not for other instances?

1172


What is the difference between C and CPP?

1212


Why c++ is faster than java?

1105


How can an improvement in the quality of software be done by try/catch/throw?

1140


What are features of c++?

1264


Is there structure in c++?

1078


Describe linked list using C++ with an example.

1123