01 // Explizite Funktionsanforderung - 1
02 // Datei: expliz1.cpp
03
04 #include
<iostream.h>
05
06 template <class TYP>
07 TYP max (TYP op1, TYP op2)
08 {
09
return op1 > op2 ? op1 : op2;
10 }
11
12 int main ()
13 {
14 int x;
15 x = max(10,20);
16
cout << "\n\nErgebnis: " << x;
17 x = max (A,B);
18 cout << "\nErgebnis:
" << hex << x;
19 // x = max (20,A); // Fehlermeldung
20
21 return 0;
22
}
23
|
Bild 17-7 Exakte Generierung von Funktionen
|