1

```
#include <iostream>
#include <cmath>
using namespace std;
class point
{
public:
point(int xcoord , int ycoord); //constructor
point();
int getX();
int getY();
double getDistance( point otherPoint );
void setpnt(point p);
private:
int x, y;
};
class rectangle
{
public:
rectangle(point p1, point p2, point p3, point p4);
void perimeter();
int area(point, point);
private:
point pt1;
point pt2;
point pt3;
point pt4;
};
point::point()
{
x = 1;
y = 2;
}
point::point(int xcoord, int ycoord )
{
x = xcoord ;
y = ycoord ;
}
double point::getDistance( point otherPoint)
{
double distance;
int xdist = otherPoint.x - x;
int ydist = otherPoint.y - y;
distance = sqrt( ( xdist * xdist) + (ydist * ydist) );
return distance;
}
int point::getX()
{
return x;
}
int point::getY()
{
return y;
}
void point::setpnt(point p)
{
x = p.getX();
y = p.getY();
}
rectangle::rectangle(point p1, point p2, point p3, point p4)
{
pt1.setpnt(p1);
pt2.setpnt(p2);
pt3.setpnt(p3);
pt4.setpnt(p4);
}
void perimeter(point pt1, point pt2)
{
int perimeter = 0;
cout << "the distance is" << point::getDistance();
}
int area()
{
int area = 0;
}
int main()
{
point pt1(2,3) , pt2(7,3), pt3(7,7), pt4(2,7);
rectangle box( pt1, pt2, pt3, pt4);
//cout << "perimeter is : " << box.perimeter() << endl;
return 0;
}
```

code bug is : D:\cpp2\question4_week5.cpp(90) : error C2660: 'getDistance' : function does not take 0 parameters

Also I'm confused as how do I call another class's functions and data values?? Snce I need to find the lengh and height of a rectangle then go on to calculate the perimeter and area...

Thanks for assisting :)