Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Stooge {
- public:
- virtual Stooge* clone() = 0;
- virtual void slap_stick() = 0;
- };
- class Curly : public Stooge {
- public:
- Stooge* clone() { return new Curly; }
- void slap_stick() {
- cout << "Curly: suffer abusen"; }
- };
- Stooge* Factory::s_prototypes[] = {
- 0, new Larry, new Moe, new Curly
- };
- Stooge* Factory::make_stooge( int choice = 3 ) {
- return s_prototypes[choice]->clone();
- }
Add Comment
Please, Sign In to add comment