Goldman Sachs interview question

what's the difference between dynamic_cast, static_cast

Interview Answers

Anonymous

May 20, 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).

Anonymous

Feb 24, 2010

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