fork(20) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template<typename T>
  6. struct Base
  7. {
  8. void print1() {cout << "Base::print1" << endl;};
  9. void print2() {cout << "Base::print2" << endl;};
  10. };
  11.  
  12. template<>
  13. void Base<int>::print2() {cout << "Base<int>::print2()" << endl;};
  14.  
  15. int main()
  16. {
  17. Base<double> d;
  18. Base<int> i;
  19.  
  20. d.print1();
  21. d.print2();
  22. i.print1();
  23. i.print2();
  24. }
  25.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
Base::print1
Base::print2
Base::print1
Base<int>::print2()