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

Explain the concept of dynamic allocation of memory?

1062


Is string an object in c++?

1113


What are stacks? Give an example where they are useful.

1003


Does c++ have arraylist?

978


What is array in c++ example?

1072


Explain class invariant.

1010


You run a shell on unix system. How would you tell which shell are you running?

1130


what is a reference variable in C++?

1178


Explain function overloading and operator overloading.

1032


If a function doesn’t return a value, how do you declare the function?

1019


What is an arraylist c++?

1171


Why ctype h is used in c++?

921


How many ways can a variable be initialized into in C++?

986


What are the characteristics of friend functions?

977


Give example of a pure virtual function in c++?

1106