c++重载运算符
来源:互联网 发布:java读取blob字段 编辑:程序博客网 时间:2024/05/23 01:09
#include <iostream>using namespace std;class CVector {public: int x, y; CVector () {}; CVector (int a, int b) : x(a), y(b) {} CVector operator + (const CVector&);};CVector CVector::operator + (const CVector& param) { CVector temp; temp.x = x + param.x; temp.y = y + param.y; return temp;}int main(int argc, char const *argv[]){ CVector foo (1,3); CVector bar (2, 4); CVector result; result = foo + bar; cout << "result's x: " << result.x << ", " << "result's y: " << result.y << endl; return 0;}
阅读全文
0 0
- C++-运算符重载
- [C++]重载运算符
- C#:运算符重载
- c++-++运算符重载
- C++:重载运算符
- 运算符重载(C++)
- [c++]运算符重载
- 【C++】运算符重载
- C++--------------------------------------------运算符重载
- C#:运算符重载
- C++:运算符重载
- C++:运算符重载
- C#:运算符重载
- [C++]运算符重载
- 【c++】运算符重载
- C++:运算符重载
- C#:运算符重载
- C++:运算符重载
- 八皇后问题变种 硅谷AI硕士作业题 One assignment of the MSc in USC
- MYCAT使用篇(2)
- 一个关于php操作进行zip打包的压缩类
- 无人值守
- 用merge into 的时候提示 ORA-01733: virtual column not allowed here
- c++重载运算符
- UOJ#9 浅谈在线仙人球嵌套动态网络路径剖分优化的分支定界贪心剪枝启发式迭代加深人工智能搜索决策算法解决问题
- python中list、array、matrix辨析
- 【51nod】 1119
- 一些待关注网站备忘
- 2017.10.20课堂代码
- 802.11
- Hystrix 使用与分析
- 179. Largest Number