Why aren't "Singletons " done like this in C++:
A.hpp:
class A
{
public: static A theA;
// ...
private:
A() { /* ... */ }
};
A.cpp:
A A::theA;
rather than the complicated approaches I've
seen with the instance being allocated with "new"?
A.hpp:
class A
{
public: static A theA;
// ...
private:
A() { /* ... */ }
};
A.cpp:
A A::theA;
rather than the complicated approaches I've
seen with the instance being allocated with "new"?
Comment