Code/Recipes/Factory pattern

From Polytech Center Barcelona
Jump to: navigation, search
struct foo;

struct factory
{
    foo make_foo();
};

struct foo
{
};

foo factory::make_foo()
{
    foo f;
    return f;
}

int main()
{
    factory fact;
    auto x = fact.make_foo();
}