来个高手 帮我解决一下吧

来源:百度知道 编辑:UC知道 时间:2024/05/26 05:48:40
头文件
// SavingAccount.h

#ifndef SAVINGACCOUNT_H
#define SAVINGACCOUNT_H

class SavingAccount
{
public:

SavingAccount ( double , double );
static void modifyInterestRate(double);
void setSavingBalance ();
double getSavingBalance ();
double calculateMonthlyInterest();
~SavingAccount();
private:
static double annualInteresterRate;
double savingBalance;
};

#endif

类的.cpp文件
//savingAccount.cpp
#include "SavingAccount.h"
#include <iostream>
using std::cout;
using std::endl;

SavingAccount::SavingAccount( double rate ,double save )
{
modifyInterestRate(rate);
savingBalance = save;
}

//静态成员函数
void SavingAccount::modifyInterestRate(double a )
{
annualInteresterRate = a ;
}

void SavingAccount::setSavingBalance()
{
savingBalance= savingBalance

// SavingAccount.h

#ifndef SAVINGACCOUNT_H
#define SAVINGACCOUNT_H

class SavingAccount
{
public:

SavingAccount ( double , double );
void modifyInterestRate(double); //不要static, 本来函数就是成员函数
void setSavingBalance ();
double getSavingBalance ();
double calculateMonthlyInterest();
~SavingAccount();
private:
double annualInteresterRate; //同上
double savingBalance;
};

#endif

类的.cpp文件
//savingAccount.cpp
#include "SavingAccount.h"
#include <iostream>
using std::cout;
using std::endl;

SavingAccount::SavingAccount( double rate ,double save )
{
modifyInterestRate(rate);
savingBalance = save;
}

//静态成员函数
void SavingAccount::modifyInterestRate(double a )
{
annualInteresterRate = a ;
}

void SavingAccount::setSavingBalance()
{
sa