30 Ott 2002
Costruzione di Interfacce - Paolo Cignoni
15
Errore return 1
•[FooFactory.C]
#include "FooFactory.H"
#include "Foo.H"

Foo* FooFactory::createBadFoo(int a, int b) {

    Foo LocInst (a,b); // creates an local instance of class Foo
    return & LocInst;  // returns a pointer to this instance

} // ERROR! LocInst leaves scope
  // and it is destroyed!