blob: ddacfb699978d2283d18f36076fb892d6fe71503 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/* template definition should reside in a header file, just like inline functions */
template <class T>
class Foo
{
public:
Foo();
Foo(const Foo &);
Foo(T &);
private:
T e;
};
template <class T>
Foo<T>::Foo() : e(0)
{
}
template <class T>
Foo<T>::Foo(const Foo &f)
{
this->e = f.e;
}
template <class T>
Foo<T>::Foo(T& e)
{
this->e = e;
}
int main(int argc, char *argv[])
{
Foo<int> foo;
return 0;
}
|