I'm wondering if I haven't fully understood C++ casts versus old C-Style cast. In MFC I have this method:
CWnd * GetDlgItem(UINT uResId);
I'm expecting that a CComboBox (or CEdit), which is derived from CWnd, requires this kind of cast:
dynamic_cast<CComboBox *>(GetDlgItem(IDC_COMBO1));
// for CEdit:
dynamic_cast<CEdit *>(GetDlgItem(IDC_EDIT1));
but this operation causes a crash for using null pointer, that means that cast have failed. Using:
reinterpret_cast<CComboBox *>(GetDlgItem(IDC_COMBO1));
// for CEdit:
reinterpret_cast<CEdit *>(GetDlgItem(IDC_EDIT1));
fixes the problem, but I'm disappointed. What am I missing?