Volleynerd Knowledge Base

Thursday, September 26, 2002


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) {}

};




Comments: Post a Comment

Home