当前位置:网站首页>Rearrangement of overloaded operators
Rearrangement of overloaded operators
2022-07-01 14:37:00 【Take you to learn code】
#include<iostream>
using namespace std;
class a
{
public:
a(int year1,int month1,int day1){year=year1;month=month1;day=day1;}
friend ostream&operator <<(ostream&output,a&b);
private:
int year,month,day;
};
ostream&operator <<(ostream&output,a&b)
{
output<<b.year<<" year "<<b.month<<" month "<<b.day<<" Japan ";
return output;
}
int main()
{
a b(2022,6,29);
cout<<b;
}
Can be combined with a parametric constructor , Directly pass parameters to construct relevant functions .

边栏推荐
- 那个很努力的学生,高考失败了……别慌!你还有一次逆袭机会!
- Leetcode(69)——x 的平方根
- Pat 1065 a+b and C (64bit) (20 points) (16 points)
- Go integrates logrus to realize log printing
- Research Report on the development trend and competitive strategy of the global camera filter bracket industry
- [Verilog quick start of Niuke series] ~ multi function data processor, calculate the difference between two numbers, use generate... For statement to simplify the code, and use sub modules to realize
- Logic is a good thing
- Realize queue with stack and stack with queue (C language \leetcode\u 232+225)
- Develop small programs and official account from zero [phase III]
- 使用net core 6 c# 的 NPOI 包,讀取excel..xlsx單元格內的圖片,並存儲到指定服務器
猜你喜欢

Use the right scene, get twice the result with half the effort! Full introduction to the window query function and usage scenarios of tdengine
![[IOT completion. Part 2] stm32+ smart cloud aiot+ laboratory security monitoring system](/img/b2/e8f81ecda6f5f4fc65501aaf9f13cf.gif)
[IOT completion. Part 2] stm32+ smart cloud aiot+ laboratory security monitoring system
![[repair version] imitating the template of I love watching movies website / template of ocean CMS film and television system](/img/fa/15b1cc3a8a723ff34eb457af9f701e.jpg)
[repair version] imitating the template of I love watching movies website / template of ocean CMS film and television system

Use of Oracle database objects
![[dynamic programming] p1004 grid access (four-dimensional DP template question)](/img/3a/3b82a4d9dcc25a3c9bf26b6089022f.jpg)
[dynamic programming] p1004 grid access (four-dimensional DP template question)

2022 PMP project management examination agile knowledge points (6)

JVM performance tuning and practical basic theory part II

Using CMD to repair and recover virus infected files

Don't want to knock the code? Here comes the chance

sqlilabs less-8
随机推荐
Effet halo - qui dit qu'il y a de la lumière sur la tête est un héros
Blog recommendation | in depth study of message segmentation in pulsar
【R语言数据科学】:机器学习常见评估指标
Texstudio tutorial
Fundamentals of C language
Research Report on development trend and competitive strategy of global 4-aminodiphenylamine industry
Don't want to knock the code? Here comes the chance
sqlilabs less-11~12
Use of Oracle database objects
241. Design priorities for operational expressions
TDengine 连接器上线 Google Data Studio 应用商店
Semiconductor foundation of binary realization principle
被裁三個月,面試到處碰壁,心態已經開始崩了
NPDP能给产品经理带来什么价值?你都知道了吗?
对于编程思想和能力有重大提升的书有哪些?
光环效应——谁说头上有光的就算英雄
[14. Interval sum (discretization)]
用对场景,事半功倍!TDengine 的窗口查询功能及使用场景全介绍
一波三折,终于找到src漏洞挖掘的方法了【建议收藏】
What problems should be considered for outdoor LED display?