Re: указатель на метод базового класса и права доступа
От: Greg Zubankov СССР  
Дата: 17.10.06 10:36
Оценка: 16 (3)
Здравствуйте, biomorph, Вы писали:

B>Почему же нельзя взять адрес, чем это продиктовано? Если можно с ссылками на стандарт.

B>Спасибо

11.5/1 Protected member access

When a friend or a member function of a derived class references a protected nonstatic member function or protected nonstatic data member of a base class, an access check applies in addition to those described earlier in clause 11. Except when forming a pointer to member (5.3.1), the access must be through a pointer to, reference to, or object of the derived class itself (or any class derived from that class) (5.2.5). If the access is to form a pointer to member, the nested-name-specifier shall name the derived class (or any class derived from that class).


Т.е. надо использовать так:
    void funcB()
    {
        B::funcA(); // ok
        A::funcA(); // ok        
        &B::funcA;  // error
    };
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.