为什么友元访问基类静态保护成员时,不能使用成员名限定方法访问?
#include <iostream>using namespace std;
class A{
protected:
static int a,b;
};
int A::a=1,A::b=2;
class C:public A{
int m;
public:
friend class F;
C(int p){
m=p;
}
};
class F{
public:
void func(){
cout<<A::a <<endl;
}
};
int main(){
C c(100);
F f;
f.func();
return 0;
}
error C2248: 'a' : cannot access protected member declared in class 'A'