I am trying to use a delegated constructor and am trying to follow the format found in this question and this question, however, I am still having issues.
My player.h
file is this:
#ifndef PLAYER_H_
#define PLAYER_H_
#include <string>
class Player
{
public:
Player(void);
Player(std::string name, int score);
~Player();
protected:
std::string name_;
int score_;
};
#endif
My player.cpp
file is this:
#include "player.h"
Player::Player(std::string name, int score)
{
score_ = score;
name_ = name;
}
Player::Player(void) : Player(NULL,0)
{
}
However, when I try to compile, I get the following error:
1>a:\projects\test\src\player.cpp(5): error C2614: 'Player' : illegal member initialization: 'Player' is not a base or member
What am I doing wrong? If it is relevant, I am using VS2012.