is throwing exception from a constructor not a good practice ?

Answer Posted / manjunath

Throwing a exception from constructor is perfectly good
habit. That is how to handle errors in the constructor.
Smart pointers can also be used in this scenario.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the outcome of cout< a) 16 b) 17 c) 16.5

698


What is isdigit c++?

683


What is the return value of the insertion operator?

713


Will a recursive function without an end condition every quit, in practice a) Compiler-Specific (Some can convert to an infinite loop) b) No c) Yes

693


Is the declaration of a class its interface or its implementation?

794






What is a storage class? Mention the storage classes in c++.

670


What is an overflow error?

716


Explain the concept of friend function in c++?

712


Is it possible to use a new for the reallocation of pointers ?

676


What is the array and initializing arrays in c++?

614


What is c++ and its uses?

720


What is #include cmath?

734


What is #include c++?

665


what is upcasting in C++?

823


What are the uses of typedef in a program?

693