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
How to declaring variables in c++?
How many types of scopes are there in c++?
What is vector pair in c++?
When there is a global variable and local variable with the same name, how will you access the global variable?
Differentiate between a constructor and a method in C++.
Explain what are mutator methods in c++?
what is Loop function? What are different types of Loops?
What are the advantages of early binding?
What is a far pointer? where we use it?
Is c++ map a hash table?
Explain the concept of memory leak?
Can a program run without main function?
Explain the isa and hasa class relationships.
What is the use of string in c++?
Write about the local class and mention its use?