//-------------------------------------------------------------------- // point2.cpp //--------------------------------------------------------------------
// Partial implementation of the expanded Point class.
#include <iostream.h> #include <math.h> #include "point2.h"
//-------------------------------------------------------------------- // // Insert the implementation of the Point class here. // //--------------------------------------------------------------------
Point::Point ()
// Default constructor. Sets point to (0,0).
{ x = 0; y = 0; }
//--------------------------------------------------------------------
void Point::setXY ( int newX, int newY )
// Sets a point's x- and y-coordinates to the specified values.
{ x = newX; y = newY; }
//--------------------------------------------------------------------
int Point::operator == ( const Point &rightPt )
// Returns 1 if rightPt has same coordinates as a point. // Otherwise, returns 0.
{ return ( x == rightPt.x && y == rightPt.y ); }
//--------------------------------------------------------------------
void Point::operator = ( const Point &rightPt )
// Assigns (copies) rightPt to a point.
{ ; // Assigns rightPt's x-coordinate ; // Assigns rightPt's y-coordinate }