01 // reinterpret_cast
02 // Datei: reinter1.cpp
03
04 // reinterpret_cast<Zieltyp>(ausdruck)"
05 // Achtung: immer implementierungsabhängig.
06
07 int funk(int x) // Hilfsfunktion
08 {
09 return x;
10 }
11
12 int main()
13 {
14 char far * videozeiger;
15 // Wandlung von long auf Zeiger
16 videozeiger = reinterpret_cast<char far *>
    (0xb0000000L);
17
18 // Umwandlung Funktions-Zeigers
19 // Funktionszeiger
20 typedef void (* PFV)();
21 PFV pfunk = reinterpret_cast<PFV>(funk);
22 pfunk();     // falscher Aufruf der Funktion
23
24 return 0;
25 }
26
27

Bild 16-11  Typwandlungen (reinterpret_cast)