#include
#include
template
class Rect
{
T x1,x2,y1,y2;
public:
Rect(T a,T b,T c,T d) {
x1=a;
y1=b;
x2=c;
y2=d;
}
T Area();
T Distance();
};
template
T Rect::Area()
{ return (x1-x2)*(y1-y2);}
template
T Rect::Distance(){
return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
main()
{
Rect p1(2.5,3.5,5.5,7);
cout < cout < Rect p2(2.5,3.5,5.5,7.0);
cout < cout < return 0;
}
12
5
10.5
4.60977