Помогите, указатель на функцию-член производного класса
От: Аноним  
Дата: 30.09.05 23:18
Оценка:
Здраствуйте, не подскажете как заставить работать следующий код, а то 2 часа лазанья по форуму что то меня ни к чему не привели.


class Base
{
public:
    class MSG_MAP
    {
    public:
        //это как вы можете понять из WinAPI для распаковщика сообшений
        bool (Base::*On_Wm_Initdialog)(HWND ,HWND , LPARAM );    
        void (Base::*On_Wm_Command)(HWND ,int, HWND , UINT );     
    };

    MSG_MAP _msg;

};

class FromBase: public Base
{
    FromBase();
public:
    bool On_Wm_Initdialog(HWND ,HWND , LPARAM){return 1;};    
    void On_Wm_Command(HWND ,int, HWND , UINT ){};

    MSG_MAP _msg_doth;
};

FromBase::FromBase()
{
    _msg_doth.On_Wm_Command = On_Wm_Command;
    _msg_doth.On_Wm_Initdialog = On_Wm_Initdialog;

}



вываливается такой еррор

error C2440: '=' : cannot convert from 'void (__thiscall FromBase::* )(int,int,int,int)' to 'void (__thiscall Base::* )(int,int,int,int)'
Cast from base to derived requires dynamic_cast or static_cast

error C2440: '=' : cannot convert from 'bool (__thiscall FromBase::* )(int,int,int)' to 'bool (__thiscall Base::* )(int,int,int)'
Cast from base to derived requires dynamic_cast or static_cast

Желаьельно подскажите решение не слишком замудреное, Спасибо
Re: Помогите, указатель на функцию-член производного класса
От: Аноним  
Дата: 30.09.05 23:19
Оценка:
да хотел добавить
ошибка тут

_msg_doth.On_Wm_Command = On_Wm_Command;
_msg_doth.On_Wm_Initdialog = On_Wm_Initdialog;
Re: Помогите, указатель на функцию-член производного класса
От: Анатолий Широков СССР  
Дата: 01.10.05 08:11
Оценка:
FromBase::FromBase()
{
    _msg_doth.On_Wm_Command = static_cast<void (Base::*)(int, int, int, int)>(On_Wm_Command);
    _msg_doth.On_Wm_Initdialog = static_cast<void (Base::*)(int, int, int)>(On_Wm_Initdialog);
}
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.