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
;
}
查看全文
相关阅读:
00 vue源码里面常见方法
vue 组件
vue 样式
vue 表单
网络技术:NAT 网络地址转换
网络技术:ACL 访问控制列表
网络技术:VLAN 虚拟局域网
Java程序设计——购物车系统
网络 2011-2012 C 语言第三次作业批改总结
第一用CSS
原文地址:https://www.cnblogs.com/cutepig/p/940524.html
最新文章
为知笔记的markdown图片处理
悲催!kbmMW 5.13竟然无法在10.4.1 android编译通过
Delphi 10.4.2最新消息
好消息!ChinaCock新版即将到来,支持华为扫码!
Nginx的配置文件详解(超详细)
asp.net core 修改 HTML 而不需要重新 run 的方法
java处理苹果浏览器safari无法播放视频流(Accept-Ranges)
每周进度总结21
每日进度总结80
每日进度总结79
热门文章
自我认为可以奖励加分的地方
java课程回顾总结
每日进度总结78
每日进度总结77
每日进度总结76
每日进度总结75
每日进度总结74
批量导入子组件
vuex
vuecli3
Copyright © 2011-2022 走看看