Guest User

Untitled

a guest
Apr 26th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. class Stooge {
  2. public:
  3. virtual Stooge* clone() = 0;
  4. virtual void slap_stick() = 0;
  5. };
  6.  
  7. class Curly : public Stooge {
  8. public:
  9. Stooge* clone() { return new Curly; }
  10. void slap_stick() {
  11. cout << "Curly: suffer abusen"; }
  12. };
  13.  
  14. Stooge* Factory::s_prototypes[] = {
  15. 0, new Larry, new Moe, new Curly
  16. };
  17. Stooge* Factory::make_stooge( int choice = 3 ) {
  18. return s_prototypes[choice]->clone();
  19. }
Add Comment
Please, Sign In to add comment