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
Which is best ide for c++?
What is string in c++ programming?
How is modularity introduced in C++?
What is difference between n and endl in c++?
What is double in c++?
What is a rooted hierarchy?
What is general form of pure virtual function? Explain?
What are the advantages of using typedef in a program?
Why is it necessary to use a reference in the argument to the copy constructor?
What are namespaces in c++?
What is the oldest programming language?
What is an arraylist c++?
What is the extraction operator and what does it do?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create
How many keywords are used in c++?