c++: No instance of overloaded function?

You’ve not included <string> header file in stock.h header file, even though you’re using std::string in it. Maybe that is causing this error message (if that is the case, then I would say its really a bad message).

Another problem is that in Stock class definition, you’ve written this:

bool Stock::operator > (Stock & aStock);

which is wrong. Remove Stock:: from it, and make it like this:

bool operator > (const Stock & aStock);
               //^^^^ add this also (better)

Stock:: is required when defining the function outside the class.

Leave a Comment