📄 emp_exceptions.cpp
字号:
// Implementation file for employee exception classes#include "emp_exceptions.h"#include <iostream>using namespace std;//// OverpaidException class ////// Use base class constructor to initialize nameOverpaidException::OverpaidException( string name, double salary ) : EmpException( name ) { m_Salary = salary;}// Use base class copy constructor to copy nameOverpaidException::OverpaidException( const OverpaidException& e ) : EmpException( e ) { m_Salary = e.m_Salary;}void OverpaidException::Complain() const { // Print error message saying who is paid too much, // and how overpaid they are cout << m_Name << " is not worth the $" << m_Salary << " we pay each year!" << endl;}//// LazyException class ////// Use base class constructor to initialize nameLazyException::LazyException( string name, int hours ) : EmpException( name ) { m_Hours = hours;}// Use base class copy constructor to copy nameLazyException::LazyException( const LazyException& e ) : EmpException( e ) { m_Hours = e.m_Hours;} void LazyException::Complain() const { // Print error message saying who is lazy, // and how little they work per week cout << m_Name << " is a lazy bum who only works " << m_Hours << " hours per week!" << endl;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -