Original Post
Hello,
Something that''s been bothering me... and I can''t find the answer ''cos I took all my C++ books back to the library.
If you throw an exception from a member function of a dynamically allocated object, is the object deleted? If not, how can you delete it?
I''ll give an example: say I create an object dynamically inside a try block, using a local pointer. Then I call a member function of the object which throws an exception. The pointer is lost (I assume) when control passes to the next catch block. What happens to the object after that?
PS I know I could use "delete this;" before throwing the exception but what effect would that have on local objects?