c++: No instance of overloaded function
27,217
Solution 1
In the header you have:
highInterestChecking(std::string =" ",int = 0, double = 0.00, double = 0.00, double = 0.00);
Which takes 5
arguments, In the source file you have:
highInterestChecking::highInterestChecking(string name, int acct, double bal, int numCheck, double min, double i)
^^^^^^^^^^^
which takes 6
arguments. It seems like int numCheck
does not match the header signature.
Solution 2
You have this constructor in the class declaration:
highInterestChecking(std::string =" ",int = 0, double = 0.00, double = 0.00, double = 0.00);
and this one in the class definition:
highInterestChecking::highInterestChecking(string name, int acct, double bal, int numCheck, double min, double i)
The parameter types from both parameter lists must match.
Solution 3
highInterestChecking::highInterestChecking(string name, int acct,
double bal, int numCheck, double min, double i)
//^^^
does not exist in your class's header file, header file has 5 parameters, but you have 6 in cpp file, parameter type seems mismatched,
Author by
Eric Oudin
Updated on May 09, 2020Comments
-
Eric Oudin almost 4 years
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); }
I have the error "No instance of overloaded function." under the constructor name highInterestChecking in the cpp file not sure what is causing it ive looked at it for a while now can't seem to find an error. maybe someone will help?
-
Lightness Races in Orbit almost 11 yearsThis is misleading. They don't need to be "the same" lexically, though they must describe the same list of parameter types.
-
Eric Oudin almost 11 yearsThank you lol how did i miss that i swear i counted the parameters guess my eyes are starting to go lol
-
juanchopanza almost 11 years@EricOudin that is a sign you have too many parameters. You could consider bundling some of them into a class.