Hello, thanks for any help ahead of time, I have a player class and I am trying to subtype it with a Simple player. I can't use any other approach, and can only change main. But when I get the pointer to the simple player, it doesn't recognize the subtype.
I have:
1 2 3 4 5 6 7 8 9 10
|
#include "player.h"
class Simple : public Player {
public:
int bet(unsigned int bankroll, unsigned int minimum);
bool draw(Card dealer, const Hand &player);
void expose(Card c){}
void shuffled(){}
};
| |
with definitions, then I have:
1 2 3 4 5
|
static Simple simple;
Player *get_Simple(){
return &simple;
}
| |
and in my main I try to:
1 2
|
Player * s = get_Simple();
s.bet(5,10);
| |
but I get:
main.cpp: In function `int main()':
main.cpp:14: error: request for member `bet' in `s', which is of non-class type
`Player*'
also, why when I do:
Simple s;
I get
main.cpp:12: error: `Simple' was not declared in this scope
main.cpp:12: error: `s' was not declared in this scope
*s.bet(5,10);
gives:
main.cpp: In function `int main()':
main.cpp:14: error: request for member `bet' in `s', which is of non-class type
`Player*'
But at this point I am just trying things )
Thank you!