// TestCpp.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <functional>
#include <iostream>
using namespace std;
class Test
{
public:
Test() {}
~Test() {}
int getVal()
{
return m_val;
}
int add(int a, int b)
{
m_val = a + b;
return m_val;
}
private:
int m_val;
};
int _tmain(int argc, _TCHAR* argv[])
{
Test *t = new Test;
auto func = std::bind(&Test::add,t,std::placeholders::_1,std::placeholders::_2);
int val = func(1,1);
cout << val << endl;
delete t;
t = NULL;
getchar();
return 0;
}