Lecture 33
files in ./
ptr_exs2.cpp gives several examples of how pointers can be used
and demonstrates some of the hazards that arise when using them.
files in ./object_default
The following files represent a basic class structure, where a BigClass
contains an object of ThisClass and ThatClass, and ThisClass
contains two objects of SmallClass. The file class_tester.cpp
provides source code that requires calls to C++ destructor, copy constructor and
operator= functions.
files in ./object_impl
The following files implement destructor, copy constructor, and operator= functions
that are identical to the C++ defaults, except that we have added print statements to
help us monitor when each is called.
files in ./ptr_shallow_impl
The following files implement a naive approach to representing the class objects
from above as pointers to objects instead of objects. This code keeps the default
implementations for copy constructor and operator= to demonstrate the problems
that may arise, even if we remember to create new objects in the constructor and
delete them in the destructor.