📄 employee.cpp
字号:
// Implementation file for the Employee class#include "employee.h"using namespace std;Employee::Employee( const string& name, const string& ssn ) { // Store arguments in member variables cout << "Constructing an employee!" << endl; m_Name = name; m_SSN = ssn;}Employee::Employee( const Employee& e ) { // Copy data members from e m_Name = e.m_Name; m_SSN = e.m_SSN;}Employee::~Employee() { // Nothing to destroy here, because the data members // will be de-allocated automatically cout << "Destroying an employee!" << endl;}void Employee::SendTo( ostream& out ) const { // Output data members out << "Name: " << m_Name << endl; out << "SSN: " << m_SSN << endl; out << "Yearly Pay: $" << GetYearlyPay() << endl;}Employee& Employee::operator=( const Employee& e ) { // We don't need this operator to do anything since // we never want it to be used return *this;}ostream& operator<<( ostream& out, const Employee& e ) { // Regardless of the kind of employee is passed, the // appropriate SendTo function will be called, because // it's declared virutal in the Employee class e.SendTo( out ); return out;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -