#include <iostream>
using namespace std; class Point{
public:
Point(int _x = 0, int _y = 0, int _z = 0):x(_x), y(_y), z(_z){}
Point(){}
~Point(){}
friend ostream& operator<<(ostream &os, const Point &pd);
private:
int x;
int y;
int z;
}; ostream& operator<<(ostream &os, const Point &pd){
os << pd.x<<" "<<pd.y<<" "<<pd.z;
return os;
} int main() {
Point pd(1,2,3);
cout<<pd;
return 0;
}

基本的注意点就是。要把函数作为class Point的友元函数,在类的外面进行定义,此外要注意return os。达到链式的作用。

最新文章

  1. IOS 使用KBMMW 访问JAVA 服务
  2. php开发(TP框架使用)
  3. iOS 企业证书发布app 流程
  4. 18.用两个栈实现队列[2StacksToImplementQueue]
  5. 使用 CJSON 在C语言中进行 JSON 的创建和解析的实例讲解
  6. HTML框架与布局
  7. Spring入门篇总结:
  8. C# — Windows服务安装后自动停止问题
  9. 数据库事务的四大特性以及事务的隔离级别(mysql)
  10. java 常用集合list与Set、Map区别及适用场景总结
  11. 《DSP using MATLAB》 Problem 4.9
  12. 树链剖分-点的分治(dis[i]+dis[j]==k的点对数量)
  13. Redis(三):Redis数据类型
  14. 跨平台sdk接入总结
  15. Building Maintainable Software-java篇之Separate Concerns in Modules
  16. webpack vue-cli 一有空格和分号就报错
  17. 网页设计和制作,数学,access 2010
  18. spark源码笔记
  19. 11_listview入门
  20. 00048_this关键字

热门文章

  1. Apache Flink
  2. hdu5336 Walk Out
  3. 基于Tire树和最大概率法的中文分词功能的Java实现
  4. PAT 1002 Hello World for U (20)
  5. google浙大招聘笔试题 师兄只能帮你到这儿了
  6. 用spring-data-redis实现类似twitter的网站(转)
  7. 基于visual Studio2013解决C语言竞赛题之1074八皇后
  8. 【学习opencv第七篇】图像的阈值化
  9. Effective C++_笔记_条款12_复制对象时勿忘其每一个成分
  10. Python unittest 官方文档