c++:没有重载函数的实例

c++: No instance of overloaded function

本文关键字:函数 实例 重载 c++      更新时间:2023-10-16

highInterestChecking Header:

#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);
}

在构造函数名称highInterestChecking下,我有一个错误"没有重载函数的实例"。在cpp文件中检查不确定是什么原因导致了它。我看了一会儿,现在似乎找不到错误。也许有人会帮忙?

在标题中有:

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)
                                                                                ^^^^^^^^^^^

其采用CCD_ 2自变量。int numCheck似乎与标头签名不匹配。

在类声明中有这个构造函数:

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)

两个参数列表中的参数类型必须匹配。

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

不存在于类的头文件中,头文件有5个参数,但在cpp文件中有6个,参数类型似乎不匹配,