Domanda di colloquio di Goldman Sachs

what's the difference between dynamic_cast, static_cast

Risposte di colloquio

Anonimo

24 feb 2010

I'm not a c++ person, so had to guess

Anonimo

20 mag 2010

Casting is a mechanism by which a programmer can change the interpretation of an object by the compiler. A static cast and dynamic cast both convert pointers between related types by performing a check to make sure that a pointer is being converted to a related type. However, the difference is that the static cast performs the check during compilation while the dynamic cast performs the check using runtime type identification (RTTI).