Point Program for CMP 290
//
by Ira
Pohl
//
//ADT POINT (x,y) pair
#include <iostream.h>
#include <assert.h> class point {
public:
point(): x(0), y(0){} //default constructor
//special importance is with arrays
//
//ADT POINT (x,y) pair
point(unsigned short a): x(a), y(0){} //conversion constructor
point(unsigned short a, unsigned short b): x(a), y(b){}
//initialization -primary use for constructor
point(const point& p):x(p.x), y(p.y){} //copy constructor
//special importance call by value and return mechanism
~point()//note void signature always
{ cerr << " point out of scope " <<
x << " , " << y << endl; }
private:
//implementation
unsigned short x, y; //x and y will be 0 - 1000
};
class color_point : public point {
public:
color_point():point(), color(black){}
private:
enum spectrum{black, green, blue, red} color;
};
main()
{
point p1, p2(9), p3(p2);
}