c++ < > == 重载
来源:互联网 发布:eclipse更改端口号 编辑:程序博客网 时间:2024/05/16 14:01
#include<iostream>using namespace std;//const int TURE = 1;//const int FALSE = 0;class area{private:double l;double h;public:area(double l1=0,double h1=0);bool operator >(area &temp);bool operator <(area &temp);bool operator ==(area &temp);void display();};void area::display(){cout<<l<<" "<<h<<endl;}area::area(double l1,double h1){l=l1;h=h1;}bool area::operator>(area &temp){if((l*h)>(temp.l*temp.h)){return true;}elsereturn false;}bool area::operator<(area &temp){if((l*h)<(temp.l*temp.h)){return true;}elsereturn false;}bool area::operator==(area &temp){if((l*h)==(temp.l*temp.h)){return true;}elsereturn false;}int main(){area a(1,1),b(2,2),c(2,2);cout<<"a<b"<<(a<b)<<endl;cout<<"a>b"<<(a>b)<<endl;cout<<"c==b"<<(c==b)<<endl;cout<<"a==b"<<(a==b)<<endl;return 0;}
阅读全文
0 0
- C++-重载操作符<< >> = + - * /
- C#==>运算符重载
- C/C++ 之 ‘++’、‘+’、‘+=’、‘-’、‘()’、‘--’ 操作符的重载实现重载
- C 重载
- C++<<重载
- 重载+,=,+=
- c++ < > == 重载
- 重载=运算符
- +=运算符重载
- 重载“=”运算符
- 重载运算符=
- 用C/C++实现一个日期类,重载运算符=,==,+,-,++,--,>,>=,<,<=等
- [C++] C++的运算符重载(+、-、前置--、后置--,前置++,后置++、==)
- [C++] C++的运算符重载(+、-、前置--、后置--,前置++,后置++、==)
- 好久没碰过C++,写了个String类 重载了下+ ,= 熟悉熟悉
- [C++]C++重载 opeartor= must be a nonstatic member function?
- C+=重载、重写和隐藏的区别以及实例分析
- 【C++】复制构造函数(拷贝构造函数)和=运算符重载使用的区别
- mysql下如何执行sql脚本
- 阿里云移动测试平台基础了解(上篇)
- 数据结构课程设计学生信息管理系统
- 重温反射
- 批处理与python配合编程的方法
- c++ < > == 重载
- java 中的数组
- U3D项目源码 百度云资源
- 学习笔记之线程间通信
- Linux 接口并发压力测试
- 在 Linux 下安装 JDK 并配置环境变量的方法
- Shiro之CAS单点登录-yellowcong
- 《剑指offer》刷题笔记(字符串):字符流中第一个不重复的字符
- request.getParameter()获取不到数据的问题