📄 emp_exceptions.h
字号:
// Header file for employee-related exception classes#ifndef EMP_EXCEPTIONS#define EMP_EXCEPTIONS#include <string>// Base class for any employee-related error conditionclass EmpException {public: EmpException( std::string name ) { m_Name = name; } EmpException( const EmpException& e ) { m_Name = e.m_Name; } virtual ~EmpException() {} // This makes class abstract virtual void Complain() const = 0; protected: std::string m_Name; // name of offending employee} ;// Derived class used to complain about overpaid employeesclass OverpaidException : public EmpException {public: OverpaidException( std::string name, double salary ); OverpaidException( const OverpaidException& e ); ~OverpaidException() {} // Outputs specific complaint void Complain() const; private: double m_Salary; // excessive yearly salary} ;// Derived class used to complain about hourly employees// who don't work enough hours per weekclass LazyException : public EmpException {public: LazyException( std::string name, int hours ); LazyException( const LazyException& e ); ~LazyException() {} // Outputs specific complaint void Complain() const; private: int m_Hours; // Hours offending employee works per week} ;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -