01 // typeid - Schlüsselwort
02 // Datei: typeid1.cpp
03
04 #include <iostream.h>
05 #include <typeinfo.h>
06
07 class basis
08 {
09 virtual int v_methode(){}
10 };
11 class abgel_1 : public basis {};
12
13 int main ()
14 {
15 abgel_1 a_obj;
16 basis * bp = &a_obj;
17 double dvar;
18 cout << "Typ 1: " << typeid(int).name() << endl;
19 cout << "Typ 2: " << typeid(dvar).name()<< endl;
20 cout << "Typ 3: " << typeid(*bp).name() << endl;
21 cout << "Typ 4: " << typeid(bp).name() << endl;
22 return 0;
23 }
24

Bild 19-2  Arbeiten mit typeid