首先是构造函数,重载

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#define maxn 65540
using namespace std; struct Node
{
int x,y;
Node (int x = 0,int y = 0):x(x),y(y) {} //构造函数
};
Node operator + (const Node& a,const Node& b)
{
return Node(a.x+b.x,a.y+b.y);
}
ostream& operator << (ostream &out,const Node& p) //重载流输出方式
{
out<<"("<<p.x<<","<<p.y<<")";
return out;
}
int main()
{
Node a,b(1,2);
Node c = a+b;
cout<<a+b<<endl;;
}

最新文章

  1. Appium移动自动化框架
  2. Web Api中的get传值和post传值
  3. Git连接Github
  4. oracle的表名、字段名、constraint名的长度限制分别是多少?
  5. Android 一个Activity保存它自己的实例
  6. CC ANUMLA(STL的运用)
  7. glusterfs快速安装
  8. xmlplus 组件设计系列之八 - 分隔框(DividedBox)
  9. shell-输入与输出&lt;echo, read, cat, tee &gt;
  10. windows :config windows update &hellip; 一直处于假死状态
  11. React项目中实现右键自定义菜单
  12. 文本分类TextCNN
  13. java_19List 集合
  14. java集合框架联系小图
  15. 【idea】清除类中无用的包
  16. python中的ljust、rjust
  17. [THUSC2017]巧克力[斯坦纳树、随机化]
  18. Anti-Forgery Request Recipes For ASP.NET MVC And AJAX
  19. JAVA GUID
  20. Python 安装pytz

热门文章

  1. luogu P3393 逃离僵尸岛-搜索剪枝+spfa
  2. POJ 2349 Arctic Network(贪心 最小生成树)
  3. ubuntu修改apt-get源为国内镜像源
  4. pycharm配置git--图文教程
  5. zoj 1240
  6. MySQL数据库不识别server=.而是识别localhost
  7. 『NYIST』第八届河南省ACM竞赛训练赛[正式赛一]CF-236B. Easy Number Challenge
  8. UVA 11090 判负圈问题
  9. bzoj1190 [HNOI2007]梦幻岛宝珠 动态规划
  10. springboot注释详解