1
#include <iostream>
using namespace std;
class Point
{private:int x;int y;
public:Point(int a,int b){x=a;y=b;}};
class Rectangle
{friend class Point;
private:Point A;Point B;
public:Retangle(Point a,Point b):A(a),B(b){}
Retangle (Rectangle &p)
{A=p.A;B=p.B;}
int getArea()
{return (B.x-A.x)*(B.y-A.y);}};
int main()
{
Point p1(1,2),p2(3,4);
Rectangle juxing1(p1,p2);
Rectangle juxing2(juxing1);
cout<<juxing1.getArea()<<endl;
cout<<juxing2.getArea()<<endl;
return 0;
}
using namespace std;
class Point
{private:int x;int y;
public:Point(int a,int b){x=a;y=b;}};
class Rectangle
{friend class Point;
private:Point A;Point B;
public:Retangle(Point a,Point b):A(a),B(b){}
Retangle (Rectangle &p)
{A=p.A;B=p.B;}
int getArea()
{return (B.x-A.x)*(B.y-A.y);}};
int main()
{
Point p1(1,2),p2(3,4);
Rectangle juxing1(p1,p2);
Rectangle juxing2(juxing1);
cout<<juxing1.getArea()<<endl;
cout<<juxing2.getArea()<<endl;
return 0;
}