C++ Singleton Pattern
only one copy of the static member available to callers.
class egg
{
public:
static egg* instance() { return &E; }
int val() { return i; }
private:
static egg E;
int i;
egg(int I) : i(I) {}
};
Posted 11:13 AM
|
0 comments
|
Permalink