?? salaried.cpp
字號:
// Implementation file for the Salaried class#include "salaried.h"using namespace std;Salaried::Salaried( const string& name, const string& ssn, double salary ) : Employee( name, ssn ) { // First the base class constructor is called, to store // the name and ssn. Here, we store the salary cout << "Constructing a salaried employee!" << endl; m_Salary = salary;}Salaried::Salaried( const Salaried& s ) : Employee( s ) { // Copy data members that haven't already been copied // using the base class copy constructor m_Salary = s.m_Salary;}Salaried::~Salaried() { // Nothing to destroy here, because the data members // will be de-allocated automatically cout << "Destroying a salaried employee!" << endl;}double Salaried::GetYearlyPay() const { // Multiply monthly salary by months in a year return m_Salary * 12;}void Salaried::SendTo( ostream& out ) const { // First call base class function Employee::SendTo( out ); // Now output class-specific members out << "Salary: $" << m_Salary << " per month" << endl;}Salaried& Salaried::operator=( const Salaried& s ) { // We don't need this operator to do anything since // we never want it to be used return *this;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -