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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.