Object Destruction in Managed C++ code

  • Thread starter Thread starter Craig Whatley
  • Start date Start date
C

Craig Whatley

Is it true that for a managed Visual C++ object, you can write a destructor
and call that destructor to deallocate that object's memory (just like with
an unmanaged C++ object)?

If this is true, will the Garbage Collector free the object when it runs if
you didn't explicitly free the object yourself?

I've read that Visual C++ is the only .NET language that gives the
programmer control over object lifetimes - C#, J#, and Visual Basic have no
choice but to use the garbage collector. Just wanted to make sure this
statement applies to managed C++ objects (like it does to unmanaged C++
objects).

Thanks!
Craig
 
Back
Top