operator
来源:互联网 发布:淘宝客服主管绩效考核 编辑:程序博客网 时间:2024/06/04 18:25
#include <iostream>#include <windows.h>#include <tchar.h>using namespace std;class Test{public:Test(){};Test(int a,int b){x=a,y=b;}Test operator+(Test t){Test temp;temp.x=x+t.x;temp.y=y+t.y;return temp;}void operator-(Test t){this->x=this->x-t.x;this->y=this->y-t.y;return;}int x;int y;};int main(void){Test t1(1,2);Test t2(2,3);Test t3;t3=t1+t2;cout<<t3.x<<endl<<t3.y<<endl;cout<<"---------------------------"<<endl;t2-t1;cout<<t2.x<<endl<<t2.y<<endl;return 0;}/*2015年3月3日9:59:57程序执行结果如下:35---------------------------11请按任意键继续. . .*/
0 0
- operator->*
- operator[]
- operator
- operator
- operator.*()
- operator[]
- Operator
- operator
- operator
- operator ->
- operator
- operator ++
- .operator
- operator*() 和 operator->()
- operator++() 和 operator++(int)
- operator 与&operator
- operator和&operator
- Stringizing Operator (#)
- LeetCode --- 46. Permutations
- SQL 遍历父子关系表(二叉树)获得所有子节点 所有父节点(转)
- Gson Jackson JSON-lib 性能比较
- 数据库连接
- 每一天都这么干:(1)打篮球40个
- operator
- plsql 常用函数
- mysql/mariadb 使用数据库名.表名更新 主从不同步的一个问题
- oracle查询表空间的大小
- AsynTask执行顺序
- LeetCode --- 47. Permutations II
- 2015年3月3号宇尘思思随笔
- xml文件读取
- RTSP服务器实例live555源代码分析