Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class IStrategy
  2. {
  3. public:
  4. virtual void use() = 0;
  5. };
  6.  
  7. class FooStrategy : public IStrategy
  8. {
  9. public:
  10. FooStrategy(A a, B b) { c = /* some operations with a, b */ }
  11. virtual void use() { std::cout << c; }
  12. private:
  13. C c;
  14. };
  15.  
  16. class BarStrategy : public IStrategy
  17. {
  18. public:
  19. BarStrategy(D d, E e) { f = /* some operations with d, e */ }
  20. virtual void use() { std::cout << f; }
  21. private:
  22. F f;
  23. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement