Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain about templates of C++.

1090


What is the best c c++ compiler for windows?

999


What is set in c++?

1071


Explain the use of virtual destructor?

1027


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1050


What happens when you make call 'delete this;'?

1031


Explain the uses oof nested class?

1096


How can you create a virtual copy constructor?

1036


What is the auto keyword good for in c++?

1120


What character terminates all character array strings a) b) . c) END

1209


Can a program run without main in c++?

1129


What causes a runtime error c++?

1075


How would you call C functions from C++ and vice versa?

1092


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.

3839


What is the best c++ compiler for windows 10?

990