Skip to content

Instantly share code, notes, and snippets.

@jacob-faber
Last active February 20, 2016 17:20
Show Gist options
  • Save jacob-faber/1515545883b2b00f0e63 to your computer and use it in GitHub Desktop.
Save jacob-faber/1515545883b2b00f0e63 to your computer and use it in GitHub Desktop.
class Player {
public:
Player();
virtual void who() = 0;
};
class HumanPlayer: public Player {
void who() { ... };
};
class CpuPlayer: public Player {
void who() { ... };
};
Player *p1 = new HumanPlayer();
Player *p2 = new CpuPlayer();
p1->who();
p1->who();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment