[ create a new paste ] login | about

Link: http://codepad.org/xBaezzpe    [ raw code | output | fork ]

aaronla - C++, pasted on Feb 8:
#include <iostream>

template <typename T> struct Base {
   void f(int) {
       std::cout << "Base<T>::f\n";
   }
};

template <typename T> struct Derived : Base<T> {
   void g() {
       std::cout << "Derived<T>::g\n";
       f(1);
   }
   void f(float) {
       std::cout << "Derived<T>::f\n";
   }
};

int main()
{
   Derived<int> d;
   d.g();
}


Output:
1
2
Derived<T>::g
Derived<T>::f


Create a new paste based on this one


Comments: