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

📄 account.h

📁 C++ PRIME书中的原代码,看本书时可以学习的例子.
💻 H
字号:
#ifndef ACCOUNT_H
#define ACCOUNT_H

#include <string>
using std::string;

class Account {
public:
        Account( double amount, const string &owner );

        string owner();
	double dailyReturn();
        static void raiseInterest( double );
        static double interest();

	friend int compareRevenue( Account& , Account* );
private:
        static double  _interestRate;
        double         _amount;
        string         _owner;

	static const int nameSize = 16;
        static const char name[nameSize];
};


inline Account::Account( double amount, const string &owner ) :
  _amount( amount ),
  _owner( owner )
  { /* all the work is done with the member initialization list */ }


inline string Account::owner()
  { return _owner; }

inline double Account::dailyReturn()
  {
    return( _interestRate / 365 * _amount );
  }

inline void Account::raiseInterest( double incr )
  {
    _interestRate += incr;
  }

inline double Account::interest()
  { return _interestRate; }


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -