Hello I am trying to access a private member function is Gtest
.
The code looks somewhat similar to this. So, how can I access 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();
}
Since it's a static function, you should access it via the class name:
You should make a caller function though, or call it from the friend class' constructor:
or