fork download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. class Base
  5. {
  6. public:
  7. template <typename M>
  8. void install(void (T::*method)(int))
  9. {
  10. std::cout << "Hello" << std::endl;
  11. }
  12. };
  13.  
  14. template<typename T>
  15. class Child : public Base<T>
  16. {
  17. public:
  18. void test()
  19. {
  20. this->template install<double>(
  21. &T::print);
  22. }
  23. };
  24.  
  25. class Grandson : public Child<Grandson>
  26. {
  27. public:
  28. void print(int n)
  29. {
  30. std::cout << "Num:" << n << std::endl;
  31. }
  32. };
  33.  
  34. int main()
  35. {
  36.  
  37. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty