I am new and a little ignorant in C ++, and I come across C ++ - code that used a singleton pattern,
class CFoo
{
public:
static CFoo& getInstance()
{
static CFoo self;
return self;
}
private:
CFoo(){}
~CFoo(){}
};
I'm just confused, why return a static link? Is this valid code? Why didn't the programmer use a pointer?
source
share