2012年(158)
分类: C/C++
2012-11-23 16:31:00
问题的发现:
不能通过编译的代码一:
不能通过编译的代码二:
猜想:对于派生类,protected的受作用者是对象而不是类
用代码来证明:
网友评论2012-11-23 16:32:58
YoYo
Except when forming a pointer to member(definatin bellow), the private access must be through a pointer to, reference to, or object of the derived class itself (or any class derived from that class).
A pointer to member is only formed when an explicit "&" is used and its operand is a qualified-id not enclosed in parentheses.