code_junkie

Function pointer to template class member functions

Nov 11th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. template <class T> MyClass
  2. {
  3. public:
  4. void DoSomething(){}
  5. };
  6.  
  7. class Base {
  8. public:
  9. virtual ~Base(){}
  10. virtual void DoSomething() = 0;
  11. }
  12.  
  13. template <class T> class MyClass : public Base {
  14. public:
  15. void DoSomething(){}
  16. };
  17.  
  18. std::vector<Base *> objects;
  19. objects.push_back(new MyClass<int>);
  20. objects.push_back(new MyClass<char>);
Add Comment
Please, Sign In to add comment