I want function f2 in structure node to call function f1 in node instead of global function f1.
#include <iostream>
#include <functional>
int f1()
{
return 1;
}
int f2()
{
return f1();
}
struct node
{
int f1()
{
return 2;
}
std::function<int()> f2 = ::f2;
};
int main()
{
node a;
std::cout << a.f2() << "\n";
return 0;
}
I want function f2 in structure node to call function f1 in node instead of global function f1.