An overview of pointers and dynamic memory allocation in C++ is located here.
You need to download (or copy) a file Point23.cpp.
The lab assignment deals with a class Point23.cpp which implements a point that may be two- or three-dimensional, i.e. some instances of the class have 2 coordinates, and some have 3. The coordinates are stored in an array of size 2 or 3 pointed to by a pointer dataPtr. The array is allocated dynamically (i.e. while the program is running) by a class constructor that creates a point.
There are 3 constructors for the class Point23: a constructor that takes two arguments creates a two-dimensional point, a constructor that takes three arguments creates a three-dimensional point, and the default constructor (with no arguments) creates a two-dimensional point with both coordinates initialized to 0s.
The class Point23 provides a class destructor that deallocates the array of coordinates.
Comments in the given program mark places where you need to add code for each of the exercises.
This assignment is just an illustration of dynamic memory allocation. In real-life programs this is not be the best way to implement a 2/3-dimensional point, in particular because overhead of allocating memory dynamically is not worth saving memory for one integer!
BU CAS CS - Dynamic Memory in C++ (short lab)