#include <functional>
#include <iostream>

class Foo
{
public:
	void bar() { std::cout << "Member function: Foo::bar()\n"; }
};

void bar()
{
	std::cout << "Free function: bar()\n";
}

class Functor
{
public:
	void operator()() { std::cout << "Functor object\n"; }
};

auto lambda = []() { std::cout << "Lambda expression\n"; };

void doSomething(std::function<void ()> fn)
{
	fn();
}

int main()
{
	doSomething(bar);
	doSomething(Functor());
	doSomething(lambda);
	
	Foo foo;
	doSomething(std::bind(&Foo::bar, &foo));
	
	return 0;
}