Explizite Konvertierung
Upcasts und Downcasts
// File: AmbBase.cc #include <MultBase.h> int main() { C c(1, 'A', 3.3); c.printC(); A* pA = &c; pA->printA(); B* pB = &c; pB->printB(); S* pS1 = (A*)(&c); pS1->printS(); S* pS2 = (B*)(&c); pS2->printS(); // obwohl c on Stack: unsigned diff = unsigned(pS2) - unsigned(pS1); cout << hex << "&c = " << (&c) << endl << "pS1 = " << (pS1) << endl << "pS2 = " << (pS2) << endl << dec << "Differenz (dec) = " << diff << endl << "sizeof(c) = " << sizeof(c) << endl; return 0; }