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
Explain about templates of C++.
What is the best c c++ compiler for windows?
What is set in c++?
Explain the use of virtual destructor?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
What happens when you make call 'delete this;'?
Explain the uses oof nested class?
How can you create a virtual copy constructor?
What is the auto keyword good for in c++?
What character terminates all character array strings a) b) . c) END
Can a program run without main in c++?
What causes a runtime error c++?
How would you call C functions from C++ and vice versa?
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.
What is the best c++ compiler for windows 10?