Select Git revision
templates-07.cpp
Peter Gerwinski authored
templates-07.cpp 369 B
#include <iostream>
using std::cout;
using std::endl;
class bla
{
public:
int content;
bla (int x):
content (x)
{
}
};
template <typename t>
void print (t x)
{
cout << x << endl;
}
template <>
void print (bla x)
{
cout << x.content << endl;
}
int main ()
{
print (42);
print ("Hello, world!");
bla blubb (137);
print (blubb);
return 0;
}