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
Why is c++ called oops?
Can a constructor return a value?
What is general format for a prototype?
What is the use of cmath in c++?
List the types of polymorphism in c++?
What is singleton class in c++?
Write a code/algo to find the frequency of each element in an array?
Is java a c++?
Specify different types of decision control statements?
Explain the different access specifiers for the class member in c++.
What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?
What data encapsulation is in c++?
When you overload member functions, in what ways must they differ?
What are the 3 levels of programming languages?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)