Is there a good way to do this C++ single-player class? I am making a little single-player game and to help with scoring I have created a Player class. Can you review my implementation?

I know that for a multiplayer game this isn't good. For multiplayer I would need to call functions and have all players in one instance.

File player.h

namespace SDLGamecore {
namespace player {

    class Player
    {
    private:
        long cash;
        int workers;
        std::string name;
    public:
        Player(std::string playerName)
        {
            name = playerName;
            cash = 0;
            workers = 0;
        }
        ~Player(){}

        long getCurrentCash() const;
        int getWorkers() const;
        std::string getPlayerName() const;
    };
}}


File player.cpp

namespace SDLGamecore {
namespace player {

    long Player::getCurrentCash() const
    {
        return cash;
    }

    int Player::getWorkers() const
    {
        return workers;
    }

    std::string Player::getPlayerName() const
    {
        return name;
    }

}}


File main.cpp

Player player("Test");

std::string pName = player.getPlayerName();
std::cout &lt;&lt; pName &lt;&lt; std::endl;


The code works as expected. Thank you for any feedback and assistance in improving my single player class.
There's not a lot of substance here to review, but anyway, here are some things that may help you improve your code.

Use include guards

There should be an include guard in the .h file.  That is, start the file with:

#ifndef PLAYER_H
#define PLAYER_H
// file contents go here
#endif // PLAYER_H


Make sure you have all required #includes

The code uses std:string within player.h but doesn't #include &lt;string&gt;.  Also, carefully consider which #includes are part of the interface (and belong in the .h file) and which are part of the implementation.

Let the compiler create default destructor

The compiler will create a destructor by default which is essentially identical to what you've got, so you can simply omit both the declaraton and implementation from your code.

Prefer modern initializers for constructors

The constructor could use the more modern initializer style rather than the old style you're currently using.  Instead of this:

Player(std::string playerName) 
{
    name = playerName;
    cash = 0;
    workers = 0;
}


You could use this:

Player(std::string playerName) :
    cash{0},
    workers{0},
    name{playerName}
{ }


Write member initializers in declaration order

When you start writing constructors in the modern style mentioned above, you'll want to make sure that you write the initializers in the same order as they are declared. Because members are always initialized in declaration order and cash is declared before name in this class. To avoid misleading another programmer, you should make the order match in all constructors.

Don't write Java in C++

While it may be fashionable in Java to write canonical getters and setters of the form you've got, it's definitely not C++ style.  Consider these two lines from main:

std::string pName = player.getPlayerName();
std::cout &lt;&lt; pName &lt;&lt; std::endl;


We already know the object is a player, so saying player.getPlayerName() seems redundant.  I'd prefer to just write player.name() like this:

std::cout &lt;&lt; player.name() &lt;&lt; std::endl;


Rethink namespaces

Is it really necessary to have a player namespace encapsulating a Player class?  Specifying your own namespace is a good idea, but nesting them deeply is probably not.  

Consider using inheritance

It's likely that your eventual game is going to have more than just Player class objects and it's also likely that those other objects will also have names.  This suggests that it might make sense to have a base class that includes common things such as name and then derive more specialized objects from it.

Provide the entire code to simplify reviews

Finally, it's not really about the code but about the review process.  A minimal real main.cpp would look something like this:

#include &lt;iostream&gt;
#include &lt;string&gt;
#include "player.h"

int main() {
    using namespace SDLGamecore::player;
    Player player("Test");

    std::cout &lt;&lt; player.name() &lt;&lt; std::endl;
}


It's usually better to post code that will actually compile without modification rather than snippets of code that require the reviewer to imagine the missing bits.  Including everything needed will help you get better and more useful reviews.