Demonstrates how to implement copy constructors and assignment overload operators.
First, open the ArrayPoint.h and ArrayPoint.cpp files and familiarize yourself with the interface and implementation. You'll find it is just two very simple representations of a point. One using integers, and another using an array.
Next, use the provided Makefile and simply type
make
This will compile and executatble called 'example'.
To run the program type
./example
You'll see a bunch of output that doesn't mean much right away. That's okay! All will become clear once you open up the copy_con_assignment_op_example.cpp and follow the step by step guide.
It may be useful to have the .cpp file one one half of your screen and the output of the program on the other. Read the steps and follow allong with the output of the program to see what is happening.
The program starts off by not having a proper copy constructor, overloaded assignment operator implemented or destructor implemented. Fear not! They are actually typed out, but are commented out in the ArrayPoint.h and ArrayPoint.cpp files. Along the way, you will go and uncomment these functions, recomplie, and run again to see different results!
That's it! Hope this helps you understand the importance of these conventions!