📄 employee.cpp
字号:
#include <iostream>
#include <string>
#include "Employee.h"
using namespace std;
Employee::Employee(string a,int b)
{
name=a;
salary=b;
}
Employee operator+(Employee& ex_a, Employee& ex_b) //重载运算符+
{
ex_a.name = ex_a.name + " and " + ex_b.name;
ex_a.salary = ex_a.salary + ex_b.salary;
return ex_a;
}
ostream& operator<<(ostream& output, Employee& ex) //重载流插入运算符<<
{
output << "The employee's name is " << ex.name << endl;
output << "The employee's salary is " << ex.salary << endl;
return output;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -