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
Discuss the possibilities related to the termination of a program before entering the mainq method?
What is while loops?
Using a smart pointer can we iterate through a container?
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
What do you mean by function overriding & function overloading in c++?
What is wrapper class in c++?
Is swift a good first language?
Explain the difference between abstract class and interface in c++?
What is the best way to declare and define global variables?
What is an overflow error?
Which bit wise operator is suitable for turning off a particular bit in a number?
Define what is constructor?
What is ostream in c++?
What do you mean by delegate? Can a user retain delegates?
What is the use of string in c++?