]>
Commit | Line | Data |
---|---|---|
921e5a0e JL |
1 | extern "C" int printf (const char *, ...); |
2 | ||
3 | template <class T> | |
4 | struct frob { | |
5 | T *ptr; | |
6 | void print (); | |
7 | frob (T* init) { ptr = init; } | |
8 | }; | |
9 | ||
10 | template <class T> | |
11 | void frob<T>::print () { | |
12 | printf ("this = %08x\n", this); | |
13 | printf (" ptr = %08x\n", ptr); | |
14 | printf (" values = %x %x %x ...\n", ptr[0], ptr[1], ptr[2]); | |
15 | } | |
16 | ||
17 | static int x[10]; | |
18 | frob<char> fc ("hello"); | |
19 | frob<int> fi (x); | |
20 | ||
21 | int main () { | |
22 | fc.print (); | |
23 | fi.print (); | |
24 | return 0; | |
25 | } |