我的程序中有以下用于二十一点游戏的代码:
Player *p;
Deck *d = new Deck();
Hand *playerHand = new Hand(), *dealerHand = new Hand();
p = get_Simple(); //This returns a pointer to an instance of a Simple Player for my game
Card dealerCard = d->deal();
p->draw(dealerCard, playerHand);
画被定义为
virtual bool draw(Card dealer, const Hand &player);
当我尝试运行此代码时,出现以下错误:
error: no matching function for call to 'Player::draw(Card&, Hand*&);
note: candidates are: virtual bool Player::draw(Card, const Hand&);