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
What is the identity function in c++? How is it useful?
What are the 3 levels of programming languages?
What are guid?
Can I learn c++ as my first language?
What does it mean to declare a destructor as static?
What is the default width for ouputting a long integer using the insertion operator?
How can a called function determine the number of arguments that have been passed to it?
Differentiate between a constructor and a destructor in c++.
Do you know what are static and dynamic type checking?
What is the use of 'using' declaration in c++?
What is the basic structure of a c++ program?
Explain this pointer?
What is :: operator in c++?
What is the use of endl in c++?
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)