⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 salaried.cpp

📁 斯坦福Energy211/CME211课《c++编程——地球科学科学家和工程师》的课件
💻 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 + -