Pergunta de entrevista da empresa Goldman Sachs

what's the difference between dynamic_cast, static_cast

Respostas da entrevista

Sigiloso

24 de fev. de 2010

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

Sigiloso

20 de mai. de 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).