#include <iostream.h>
class CPoint
{
public:
CPoint(int m,int n)
{
x=m;
y=n;
}
Print()
{
cout<<"x="<<x<<" y="<<y<<endl;
}
int Getx()
{
return x;
}
int Gety()
{
return y;
}
private:
int x,y;
};
class Jx:private CPoint
{
public:
Jx(int m,int n,int x=0,int y=0):CPoint(m,n)
{
a=x;
b=y;
}
print()
{
int m,n;
m=Getx();
n=Gety();
cout<<"a="<<a<<" b="<<b<<" m="<<m<<" n="<<n<<endl;
cout<<"矩形的面积是:"<<(a-m)*(b-n)<<endl;
cout<<"矩形的周长是:"<<2*((a-m)+(b-n))<<endl;
}
private:
int a,b;
};
class line:private CPoint
{
public:
line(int m,int n,int x=0):CPoint(m,n)
{
c=x;
}
print()
{
int a;
a=Getx();
cout<<"a="<<a<<" c="<<c<<endl;
cout<<"直线的距离是:"<<c-a<<endl;
}
private:
int c;
};
void main()
{
CPoint A(1,1);
A.Print();
line B(3,4,5);
B.print();
Jx C(0,0,2,4);
C.print();
}