Posts

Showing posts with the label overloading

C++ Visual Studio overloaded function error: no instance of overloaded function matches the specified type

C++ Visual Studio overloaded function error: no instance of overloaded function matches the specified type CLARIFICATION: This project is being done in Visual Studio, with an stdafx.h file used. FText is an alias for string, as established in the file stdafx.h: #include <string> using FText = std::string; using int32 = int; stdafx.h is included in the View.cpp class. ORIGINAL QUESTION: So, I am trying to create several print methods which print a string based on one or two parameters: a number parameter that indicates which message to print, and an input to be used in the message. As of now, I have three instances of the method "print", as shown below: ///A method that prints a message //give it a number to tell it what message to print. void Display::print(int message) { switch (message) { case 0: std::cout << "Welcome to Cows and Bulls, a simple word-guessing game. n"; break; case 1: //(I omit...