2

highInterestChecking ヘッダー:

#ifndef H_highInterestChecking
#define H_highInterestChecking
#include "noservicechargechecking.h"
#include <string>

class highInterestChecking: public noServiceChargeChecking
{
public:
    highInterestChecking(std::string =" ",int = 0, double = 0.00, double = 0.00, double = 0.00);
};
#endif

highInterestChecking cpp:

#include "highInterestChecking.h"
using std::string;

highInterestChecking::highInterestChecking(string name, int acct, double bal, int numCheck, double min, double i)
{
    bankAccount::setAcctOwnersName(name);
    bankAccount::setAcctNum(acct);
    bankAccount::setBalance(bal);
    checkingAccount::setChecks(numCheck);
    noServiceChargeChecking::setMinBalance(min);
    noServiceChargeChecking::setInterestRate(i);
}

「オーバーロードされた関数のインスタンスがありません」というエラーが表示されます。cpp ファイルのコンストラクター名 highInterestChecking の下で、何が原因なのかわからないので、しばらく調べてみましたが、エラーが見つからないようです。たぶん誰かが助けてくれるでしょうか?

4

3 に答える 3

5

ヘッダーには次のものがあります。

highInterestChecking(std::string =" ",int = 0, double = 0.00, double = 0.00, double = 0.00);

引数を取り5ます。ソース ファイルには次のものがあります。

 highInterestChecking::highInterestChecking(string name, int acct, double bal, int numCheck, double min, double i)

                                                                                ^^^^^^^^^^^

引数を取り6ます。int numCheckヘッダー署名と一致しないようです。

于 2013-05-08T14:47:05.133 に答える
2

クラス宣言に次のコンストラクターがあります。

highInterestChecking(std::string =" ",int = 0, double = 0.00, double = 0.00, double = 0.00);

そしてこれはクラス定義にあります:

highInterestChecking::highInterestChecking(string name, int acct, double bal, int numCheck, double min, double i)

両方のパラメーター リストのパラメーターの型が一致する必要があります。

于 2013-05-08T14:48:08.183 に答える
2
  highInterestChecking::highInterestChecking(string name, int acct, 
                           double bal, int numCheck, double min, double i)
                                       //^^^

クラスのヘッダー ファイルには存在しません。ヘッダー ファイルには 5 つのパラメーターがありますが、cpp ファイルには 6 つあります。パラメーターの型が一致していないようです。

于 2013-05-08T14:48:30.830 に答える