Is it possible? How do I do it? I need a function to return the players name, so I have this as the prototype:

string getPlayerName();

And this as the function:

string mainFunctions::getPlayerName(){
    return playerName;
}

But I get an error saying that the function called 'string' doesn't have a return type...

I have #included <string> in the header and cpp files.

Recommended Answers

Try using std::string.

Jump to Post

All 2 Replies

Try using std::string.

commented: Simple working answer, fast reply. +3

Try using std::string.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.