2
你好,我想訪問一個私人會員功能是Gtest
。代碼看起來有點類似於這個。那麼,我怎樣才能訪問static void Pri_fun
?如何通過朋友功能調用私人功能?
using namespace std;
class test{
};
class abc{
public:
friend class test;
private:
static void Pri_fun()
{
cout << "private fun called \n";
}
};
int main()
{
abc ab;
test *abd;
abd->Pri_fun();
}