fork download
  1. #include <iostream>
  2.  
  3. class c1{
  4. public:
  5. void f(){std::cout<<"In f1\n";}
  6. };
  7. class c2{
  8. public:
  9. void f(){std::cout<<"In f2\n";}
  10. };
  11.  
  12. template <typename T>
  13. class c {
  14. T t;
  15. public:
  16. T* operator->() { return &t; }
  17. };
  18.  
  19. int main()
  20. {
  21. c<c1> cMain;
  22. cMain->f();
  23. return 0;
  24. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
In f1