Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi there,



I have converted my code from vc6.0 to vs2010 and while compiling the code , i am getting the error message.

: error C2440: 'static_cast' : cannot convert from 'void (__thiscall MainWnd::* )(UINT,long)' to 'AFX_PMSG&
1> Cast from base to derived requires dynamic_cast or static_cast


Regards,

Ranjith
Posted
Comments
Sergey Alexandrovich Kryukov 8-Sep-13 3:46am    
Such cast is really invalid. The code is incorrect (even if it always works).

Use dynamic cast if you are not sure if your runtime type is the type you are casting to (if not, you will need to decide what to do), or, if you are sure, use the static cast. There kinds of cast are described in every C++ manual or a book. Read about it. You need to learn it anyway, because this is a very important part of programming, C++ programming in particular.

—SA
ranjithkumar81 23-Oct-13 7:27am    
thanks
Sergey Alexandrovich Kryukov 23-Oct-13 12:17pm    
Not at all...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900