播放器.h
#ifndef HEADER_GUARD_PLAYER
#define HEADER_GUARD_PLAYER
#include <string>
using std::string;
//Parent player class
class Player
{
private:
protected:
string playerName;
int chipCount;
public:
//Constructor
Player();
Player(string name);
};
//Custom Players
class PlayerSteven: public Player
{
};
class PlayerBlake: public Player
{
};
class PlayerTucker: public Player
{
};
#endif
播放器.cpp
#include "Player.h"
#define STARTCHIPS 1500
Player::Player()
{
chipCount = STARTCHIPS;
playerName = "Default";
};
Player::Player(string name)
{
playerName = name;
};
主文件
#include <iostream>
#include "Deck.h"
#include "Player.h"
#include <string>
using namespace std;
int main()
{
Deck deck;
PlayerSteven steven = new PlayerSteven("Steven");
PlayerBlake blake = new PlayerBlake("Blake");
PlayerTucker tucker = new PlayerTucker("Tucker");
deck.shuffle();
int x = 0;
int y = 0;
for (int i = 0; i < 52; i++)
{
deck.nextCard(x,y);
cout << x << "," << y << endl;
}
system("PAUSE");
return 0;
}
错误:
11 C:\Users\Documents\temp\p_comp.cpp 没有匹配函数调用“PlayerSteven::PlayerSteven(const char[7])”
11 C:\Users\Documents\temp\p_comp.cpp 没有匹配函数调用“PlayerSteven::PlayerSteven(const char[7])”
注意 C:\Dev-Cpp\PROJECTS\Player.h:26 PlayerSteven::PlayerSteven(const PlayerSteven&)
有人知道我怎样才能编译它吗?
谢谢。