#include <iostream> using namespace std; class ExBase { private: static int stat; public: static int GetStat(){ return stat; } }; int ExBase::stat = 25; class ExDer1 : public ExBase { public: friend int Der1Fn(){ return ExBase::stat; } }; class ExDer2 : public ExBase{}; class ExDer : public ExDer1, public ExDer2{}; A. int main() { ExDer d; cout << d.Der1Fn() << endl; } will result in an ambiguity error from the compiler. B. int main() { ExDer d; cout << d.GetStat() << endl; } will display an output as "25". C. int main() { cout << ExDer1::GetStat() << endl; } will result in an ambiguity error from the compiler. D. class ExDer1 : public ExBase { public: friend int Der1Fn(){ return ExBase::stat; } }; will result in an access error from the compiler. E. int main() { cout << ExDer1::ExBase::GetStat() << endl; } will display an output as "25". A B D E 友元函数不能访问基类private成员 因为友元函数只能访问这个类的所有成员 但是派生类不能访问基类私有成员 友元函数可以访问基类protected和public成员