< Previous | Contents | Next >
In this chapter, you should have learned the following concepts:
n Aggregation is the combining of objects so that one is part of another.
n Friend functions have complete access to any member of a class.
n Operator overloading allows you to define new meanings for built-in operators as they relate to objects of your own classes.
n The stack is an area of memory that is automatically managed for you and is used for local variables.
n The heap (or free store) is an area of memory that you, the programmer, can use to allocate and free memory.
n The new operator allocates memory on the heap and returns its address.
n The delete operator frees memory on the heap that was previously allocated.
n A dangling pointer points to an invalid memory location. Dereferencing or deleting a dangling pointer can cause your program to crash.
326 Chapter 9 n Advanced Classes and Dynamic Memory: Game Lobby
n A memory leak is an error in which memory that has been allocated becomes inaccessible and can no longer be freed. Given a large enough leak, a program might run out of memory and crash.
n A destructor is a member function that’s called just before an object is destroyed. If you don’t write a destructor of your own, the complier will supply a default destructor for you.
n The copy constructor is a member function that’s invoked when an automatic copy of an object is made. A default copy constructor is supplied for a class if you don’t write one of your own.
n The default copy constructor simply copies the value of each data member to data members with the same names in the copy, producing a member-wise copy.
n Member-wise copying can produce a shallow copy of an object, in which the pointer data members of the copy point to the same chunks of memory as the pointers in the original object.
n A deep copy is a copy of an object that has no chunks of memory in common with the original.
n A default assignment operator member function, which provides only member-wise duplication, is supplied for you if you don’t write one of your own.
n The this pointer is a pointer that all non-static member functions automatically have; it points to the object that was used to call the function.