May I know why's the answer static cast? And why isn't it dynamic cast? Do not understand. Thanks
1 2 3 4 5 6 7 8 9 10 11 12
Given following c code:
C *p = (C*)(
malloc(sizeof(C)));
What is equivalent code in c++?
C *p = interpret_cast<C*>(
malloc(sizeof(C)));
C *p = dynamic_cast<C*>(
malloc(sizeof(C)));
C *p = static_cast<C*>(
malloc(sizeof(C)));