Home > Back-end >  C functions adapter problem (bosses get me)
C functions adapter problem (bosses get me)

Time:12-19

Function adapter problem: the first parameter in the bind function using the class name "Test" member calls the add method, how to understand this way?

#include
#include
using namespace std;
Using namespace STD: : placeholders;

Int the add (int a, b int, int) c
{
return a+b+c;
}

The class Test
{
Public:
Int m_num1;
Int m_num2;
Int m_num3;

The Test (int a, b int, int) c: m_num1 (a), m_num2 (b), m_num3 (c)
{
cout <"Test_add" & lt; }
Int the add ()
{
Return m_num1 + m_num2 + m_num3;
}
};

Int main ()
{
The Test mp {1, 2, 3};
Auto t1=STD: : bind (& amp; The Test: : add, mp);
cout return 0;
}
  • Related