![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| call constructor of java class in script | thebladerunner | Shell Programming and Scripting | 1 | 10-21-2008 12:23 PM |
| Linguistic Tree Constructor 2.8.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 01-27-2008 07:30 PM |
| what is diff b/w copy constructor and overloaded assignment operator | amitpansuria | High Level Programming | 3 | 08-06-2007 12:45 PM |
| why constructor cannot be virtual | amitpansuria | High Level Programming | 2 | 08-03-2007 12:02 AM |
| Constructor problem | woot4moo | UNIX for Dummies Questions & Answers | 4 | 09-05-2006 10:49 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how do you handle a constructor and destructor that fail
helo i m new in c++ on linux
can u tell me with an simple example that how do you handle constructor and destructor that fail? Regards, Amit |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
What do you mean by fail? Throwing exception? Access violation? C++ has try/catch for handling non-fatal program-driven exceptions. Or were you actually looking for something else?
|
|
#3
|
|||
|
|||
|
I was under the impression that the only things you should put in constructors/destructors were things that would not fail (or else you deal with the exceptions inside the constructor/destructor).
|
|
#4
|
|||
|
|||
|
never throw an exception from the destructor that fails?
Quote:
Regards, Amit |
|
#5
|
|||
|
|||
|
Quote:
If you can't achieve that then you handle then use try/catch in your destructor around the part that may fail. |
|||
| Google The UNIX and Linux Forums |