“Tale of the __dtor method and the delete operator” : the return

Edward Dudenhoefer was kind enough to comment on that post. You can get this information in more details by looking at “TLS310 - Visual C++ "Whidbey": New Language Design and Enhancements (Start Session, Download Powerpoint)” but for those of you who don't have the time. Here is his e-mail:

In Whidbey:

public ref class ManagedFoo
      ManagedFoo() { m_pFoo = new Foo() ; }

      ~ManagedFoo() { delete m_pFoo ; }

      // Finalizer if you want one

     !ManagedFoo() { delete m_pFoo ; }


      Foo * m_pFoo ;
} ;


IDisposable::Dispose is automatically hooked up when a dtor is present in a class.

SupressFinalize is automatically called when a dtor is fired for an instance.

Comments (0)

Skip to main content