zoukankan
html css js c++ java
重载<<.>>(friend必须吗?)
#include
<
iostream
>
using
namespace
std;
class
position
{
public
:
position(
int
m,
int
n);
friend ostream
&
operator
<<
(ostream
&
out
,
const
position
&
s);
friend istream
&
operator
>>
(istream
&
in
,position
&
s);
int
x;
int
y;
}
;
void
main()
{
position m(
3
,
4
);
cout
<<
m
<<
endl;
cout
<<
"
输入x,y\n
"
;
cin
>>
m;
cout
<<
m
<<
endl;
}
position ::position(
int
m,
int
n) :x(m),y(n)
{}
ostream
&
operator
<<
(ostream
&
out
,
const
position
&
s)
{
out
<<
"
(
"
<<
s.x
<<
"
,
"
;
out
<<
s.y
<<
"
)\n
"
;
return
out
;
}
istream
&
operator
>>
(istream
&
in
,position
&
s)
{
in
>>
s.x;
in
>>
s.y;
return
in
;
}
查看全文
相关阅读:
测网速
fseek 在以字符串模式打开的文件中工作不正常 [MSDN]
Inno Setup: Ask for reboot after uninstall
【Inno Setup】Pascal 脚本 ---- 事件函数
在安装程序之前,预先安装别的程序
【Inno Setup】查看是否安装了VC++ 2015 Redistributeable
spark学习笔记
docker学习笔记2
kafka读书笔记《kafka权威指南》2018
mongodb
原文地址:https://www.cnblogs.com/cutepig/p/940524.html
最新文章
HttpUploader6-queue版本更新说明
HTTP Debugger Pro使用教程
WordPaster2产品介绍
WordPaster2项目变化
WordPaster2-Chrome 45安装说明
在win10 + ie11上使用控件
22. Generate Parentheses
21. Merge Two Sorted Lists
20. Valid Parentheses
19. Remove Nth Node From End of List
热门文章
18. 4Sum
17. Letter Combinations of a Phone Number
16. 3Sum Closest
15. 3Sum
14. Longest Common Prefix
13.Roman to Integer
设置共享内存大小 【windows】
How to use QueryPerformanceCounter? (c++,不使用 .Net)
c++ 更新 performance counter 数据,错误码 87
点击 QTableView,触发事件
Copyright © 2011-2022 走看看