Hello fellows.
I have tested the above code to g++ and it's ok. It does compile.
Code:
class Player {
private:
string name;
public:
Player(const string &n)
{
name = n;
}
virtual ~Player() { }
virtual const string & getType() const = 0;
virtual Move play(const State &s) = 0;
friend ostream & operator << (ostream &out, const Player &player);
};
ostream & operator << (ostream &out, const Player &player)
{
out << player.getType() << " player " << player.name;
return out;
}
I have tested on Visual Studio 2015 (C++14) and at the line out << player.getType() << " player " << player.name; i get the error error C2259: 'Player': cannot instantiate abstract class
I can't fix that error because i can't understand it. What's wrong ?