•Foo&
FooFactory::createBadFoo(int a, int b) {
Foo
aLocalFooInstance(a,b); // creates an local instance
// of the class Foo
return
aLocalFooInstance; // returns a reference to
this
// instance
} // EEK! aLocalFooInstance
leaves scope and is destroyed!