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
What is the use of setprecision in c++?
What is command line arguments in C++? What are its uses? Where we have to use this?
Which operator cannot overload?
What's the "software peter principle”?
What is pointer to array in c++?
Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300â€Â,â€ÂBullCart : 10â€Â) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side
Define upcasting.
What is array in c++ pdf?
Write a c program for binary addition of two 8 bit numbers.
What is the difference between public, private, and protected access?
Can I uninstall microsoft c++ redistributable?
Difference between pointer to constant vs. Pointer constant
What relational operators if statements in c++?
What is vector string in c++?
How to get the current position of the file pointer?