Lecture 4 - Slide 12 : 40 |
An example where it is necessary to program a destructor
For sake of the example we introduce a dynamically allocated representation of points
If an object o allocates resources when constructed - or during its life time - o's destructor is responsible for relinquishing these resources when o is deleted or goes out of scope
If o does not allocate such resources, its destructor is typcially not programmed