/*
* relation_operator.cpp
*
* Created on: 2013-9-28
* Author: Administrator
*/
#if 0
#include<iostream.h>
class Rect
{
private:
int length,width;
public:
Rect(int l,int h)
{
length = l; width = h;
}
friend int operator > (Rect a,Rect b)
{
return (a.length*a.width) > (b.length*b.width)?1:0;
}
void display()
{
cout << "面积="<<length*width<<endl;
}
};
int main(void)
{
Rect rect1(5,5),rect2(4,7);
cout << "rect1";
rect1.display();
cout << "rect2";
rect2.display();
if(rect1 > rect2)
cout << "rect1的面积大于rect2的面积"<< endl;
else
cout << "rect1的面积小于rect2的面积"<< endl;
return 0;
}
#endif
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。