fork download
  1. #include <iostream>
  2.  
  3. template <typename T>
  4. struct C
  5. {
  6. void g() {
  7. std::cout << "Common g" << std::endl;
  8. }
  9.  
  10. void f() {
  11. std::cout << "Common f" << std::endl;
  12. }
  13. };
  14.  
  15. template <>
  16. void C<int>::f() {
  17. std::cout << "f for int" << std::endl;
  18. }
  19.  
  20. int
  21. main(void)
  22. {
  23. C<int> c;
  24. c.f();
  25. c.g();
  26. return 0;
  27. }
Success #stdin #stdout 0s 4244KB
stdin
Standard input is empty
stdout
f for int
Common g