Skip to Main Content
Microsoft Visual C++/CLI Step by Step
book

Microsoft Visual C++/CLI Step by Step

by Julian Templeman
August 2013
Beginner content levelBeginner
540 pages
12h 51m
English
Microsoft Press
Content preview from Microsoft Visual C++/CLI Step by Step

Chapter 7. Controlling Object Lifetimes

After completing this chapter, you will be able to:

  • Describe how Microsoft .NET memory management differs from traditional C++ memory management.

  • Provide finalizers and destructors for your classes.

  • Create objects by using stack semantics.

Now that you know how to create objects in C++/CLI by using the gcnew operator, it’s time to learn how to control object lifetimes as well as another way to create and use objects.

The .NET approach to object lifetimes

We’ve seen what happens at the start of an object’s life, but what happens when an object is no longer required?

There are two things that need to happen when an object comes to the end of its life:

  • You might want to do some clean-up before the object is destroyed, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft Visual C++ Windows Applications by Example

Microsoft Visual C++ Windows Applications by Example

Stefan Bjornander
Visual Basic 2015 Unleashed

Visual Basic 2015 Unleashed

Alessandro Del Sole
Build Windows 8 Apps with Microsoft Visual C++ Step by Step

Build Windows 8 Apps with Microsoft Visual C++ Step by Step

Paolo Pialorsi Luca Regnicoli and Roberto Brunetti

Publisher Resources

ISBN: 9780735675162Purchase book