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

📄 realaccount.cpp

📁 financal instrument pricing using c
💻 CPP
字号:
// RealAccount.cpp
//
// (C) Datasim Education BV  2002

#include "RealAccount.hpp"

// Constructors and destructor
RealAccount::RealAccount(): Account()
{ // Default constructor

	bal=0.0;
}

RealAccount::RealAccount(double balance): Account()
{ // Constructor with initial balance

	bal=balance;
}

RealAccount::RealAccount(const RealAccount& source): Account(source)
{ // Copy constructor

	bal=source.bal;
}

RealAccount:: ~RealAccount()
{ // Destructor
}

// Virtual functions to be define in derived classes
void RealAccount::Withdraw(double amount)
{ // Withdraw some money

	if (amount>bal) throw NoFundsException();
	else bal-=amount;
}

double RealAccount::GetBalance()
{ // Return the balance

	return bal;
}

// Operator overloading
RealAccount& RealAccount::operator = (const RealAccount& source)
{ // Assignment operator

	// Call base class assignment
	Account::operator = (source);

	bal=source.bal;
	return *this;
}

⌨️ 快捷键说明

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