Hello,
how to I replace singleton classes using function scope static
variables with one that doesn't use function scope static variables?:
class Foo {
public:
static Foo &instance();
virtual ~Foo();
...
private:
Foo();
Foo(const Foo&);
Foo & operator=(const Foo&);
};
----------------------------------
Foo &Foo::instance( )
{
static Foo& theInstance;
...
return theInstance;
}
how to I replace singleton classes using function scope static
variables with one that doesn't use function scope static variables?:
class Foo {
public:
static Foo &instance();
virtual ~Foo();
...
private:
Foo();
Foo(const Foo&);
Foo & operator=(const Foo&);
};
----------------------------------
Foo &Foo::instance( )
{
static Foo& theInstance;
...
return theInstance;
}
Comment