Reputation:
class A
{
static const A a;
}
Why we can do this , while we cannot do this without the word static?
Upvotes: 0
Views: 298
Reputation: 887315
A static
member has just one value; it's essentially a global variable scoped to the class declaration.
A non-static
member is a value that appears in each class instance.
It doesn't make sense for a class to directly contain itself, since that would consume an infinite amount of memory.
You may want a pointer.
Upvotes: 4