is throwing exception from a constructor not a good practice ?
Answer Posted / vikas sood
throwing exception from a constructor is not bad at all. It
is actually advised to use exceptions when you fail to
create your object properly due to any reason. In this case
memory will not be allocated for the object and no
destructor will be called.
Is This Answer Correct ? | 11 Yes | 1 No |
Post New Answer View All Answers
Write a program to find the Fibonacci series recursively.
Why is it necessary to use a reference in the argument to the copy constructor?
Define copy constructor.
What are the advantages of pointers?
Define friend function.
What is the use of class in c++?
Is java a c++?
what are the decision making statements in C++? Explain if statement with an example?
Where the memory to the static variables is allocated?
What are put and get pointers?
Write about the stack unwinding?
Explain the concept of memory leak?
What is the difference between a definition and a declaration?
How do we balance an AVL Tree in C++?
Will a catch statement catch a derived exception if it is looking for the base class?