Lecture 4 - Slide 19 : 40
Example of copying objects: Default copying

Motivates the need for copy constructors and assignment overloading in C++

The starting point is automatic variables of class type (value semantics)

Class LineSegment has a pointer to the first Point in an array

Class LineSegment WITHOUT copy constructor and and WITHOUT assignment operator.
The corresponding cc file - not particularly relevant.
A function that constructs, initializes and assigns LineSegments.
Program execution.

The problem is that the first destruction of a LineSegment object destructs (deallocates) the shared Point array in the free store

The two next destructions encounter dangling references

The program is improved on the next slide