Muhammad, you didn't read my note close enough.  The _myIntPointer is a
private field member of Class1 so you obviously do not have access to it
as you are showing below.  Take another look at my original note.

Chad

>you can use _finally (C++) or finally (C#) blocks to make sure that no
>memory leaks happen.see the
>following code:
>
>Class1* c = NULL;
>
>try {
>   c = new Class1();
>   c.DoSomething();
>}
>catch {char* msg) {}
>finally
>{
>    if (c==Null)
>        {
>            if ( _myIntPointer!=NULL)
>            {
>                 delete _myIntPointer;
>            }
>        }
>}

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to