salaried.h
来自「斯坦福Energy211/CME211课《c++编程——地球科学科学家和工程师》」· C头文件 代码 · 共 44 行
H
44 行
// Header file for the Salaried class, derived from the// Employee base class and used to maintain records for // employees with a fixed monthly salary#ifndef CLASS_Salaried#define CLASS_Salaried#include "employee.h" // Always include header from // base classclass Salaried : public Employee {public: // Constructors Salaried() { m_Salary = 0.0; } // for reading from file Salaried( const std::string& name, const std::string& ssn, double salary ); // Copy constructor Salaried( const Salaried& s ); // Destructor ~Salaried(); // Get/Set pairs to work with member variables inline double GetSalary() const { return m_Salary; } inline void SetSalary( double s ) { m_Salary = s; } // Computes and returns yearly pay from monthly salary double GetYearlyPay() const; // Called by << operator to output member variables // specific to salaried employees void SendTo( std::ostream& out ) const; // Called by >> operator to read member variables // specific to salaried employees void GetFrom( std::istream& in, bool prompt = false ); private: double m_Salary; // monthly salary // This is declared private to prevent assignment Salaried& operator=( const Salaried& s ); };#endif // CLASS_Salaried
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?