For the line Point::setPoint(... it tells me that it is invalid and I set it to Point::&setPoint(.. with then stats it is a illegal operation. I'm a little lost on this one anyone mine pointing me in the right direction.

class Point
{
public:
	Point(double=0.0, double=0.0);
	Point &setPoint(double xPoint, double yPoint);
	double distance(Point & p);
	void print() const;
private:
	double x;
	double y;
	};

Point::setPoint(double xPoint, double yPoint)
{  
	xPoint = x; 
	yPoint = y; 
	return *this; 
}

double Point::distance(Point &p)
{
	double dis; 
	dis = sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y));
	return dis; 
}

void Point::print() const
{
	cout << "(" << x << ", " << y << ")" << endl; 
}

int main() 
{
	Point myObject, myObject2; 
	myObject.setPoint(4,5).print();
	myObject2.setPoint(3,4).print();
	return 0; 
}

Everything but a constructor needs a return type, so I assume you want this:

Point& Point::setPoint(double xPoint, double yPoint)

since it matches this declaration in the Point class (see red):

class Point
{
public:
	Point(double=0.0, double=0.0);
	Point &setPoint(double xPoint, double yPoint);
	double distance(Point & p);
	void print() const;
private:
	double x;
	double y;
	};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.