Basically, I have a class in C++
class Commands { public: void help(); void userid(); void getCmd(std::string cmd) { } };
void Commands::help() {
WriteLine("\n \
--------------------------------\n \
[ userid, id ]: Get's the UserID of your player\n \
[ placeid, game ]: Get's the game ID\n \
--------------------------------\n \
\
");
}
void Commands::userid() {
WriteLine("Your UserId is: 12345678");
}
I have a while(true) loop that runs a function which checks what the user responds with [ like a command based console ] I was wondering how I could do this:
Commands cmds;
cmds["help"]();
cmds["examplecmdhere"]();
When I try to do it I get an error Severity Code Description Project File Line Suppression State Error (active) E0349 no operator "[]" matches these operands Command