can anybody tell me What happens if an exception is throws from an, object's constructor and object's destructor?
-
can anybody tell me What happens if an exception is throws from an, object's constructor and object's destructor? thanks in dvance
-
can anybody tell me What happens if an exception is throws from an, object's constructor and object's destructor? thanks in dvance
Ask George_George: he made a extensive study about... :-D Seriously, IMHO opinion, the object consumer has to care about of that possibility exactly like it does with standard method thrown exceptions. A difference maybe the fact that object construction/destruction sometimes happens implicitly (and is somehow hidden to the consumer itself). :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles] -
can anybody tell me What happens if an exception is throws from an, object's constructor and object's destructor? thanks in dvance
[1] Constructor The object will never be created. Destructor is NOT called. If you allocated ressources before the exception is thrown, they are NOT freed. [2] Destructors Technically, the object is left in an undefined state. Likely, Accessing it afterwards will fail, and resources may leak. Practically, destructors should NEVER throw. It violates even the most basic exception safety guarantee: that objects remain destructable, no matter what. For lots of more information, try the GOTW columns[^] that deal with exceptions
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
My first real C# project | Linkify!| FoldWithUs! | sighist