Is there a way to pass foo_ around outside of main? I saw something about Boost in another question regarding functors. That looks like it may work. Here's the answer mentioning Boost in that question. If I can, I would like to avoid Boost.
#include <iostream>
int main()
{
class foo {
public:
void operator()() {
std::cout << "Hello" << std::endl;
}
};
foo foo_;
foo_();
return 0;
}