Skip to Main Content
Software Essentials
book

Software Essentials

by Adair Dingle
July 2014
Intermediate to advanced content levelIntermediate to advanced
436 pages
12h 27m
English
Chapman and Hall/CRC
Content preview from Software Essentials
Memory 101
C++ classes must dene a destructor when any class method (usually
the constructor) allocates heap memory that is retained by an object. e
destructor is a special function that has no return type (not even void)
and bears the same name as the class, preceded by ‘~’. e compiler implic-
itly invokes the destructor when objects go out of scope or when the delete
operator is called. us, the class destructor is poised to deallocate any
heap memory before its handle (an object data member) goes out of scope.
A destructor is appropriately dened in Example 4.5.
Classes must also dene a copy constructor when objects allocate
heap memory. Why? e compiler automatically provides a default copy
constructor that simply copies each ...
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

Software Architect’s Handbook

Software Architect’s Handbook

Joseph Ingeno
Economics-Driven Software Architecture

Economics-Driven Software Architecture

Ivan Mistrik, Rami Bahsoon, Rick Kazman, Yuanyuan Zhang
Software Architect Bootcamp

Software Architect Bootcamp

Raphael Malveau, Ph.D. Thomas J. Mowbray

Publisher Resources

ISBN: 9781439841204