a static member can be of the same class type as that of which it is a member. A nonstatic data member is restricted to being declared as a pointer or reference to an object of its class. C++ primer, p645, 3rd
class Bar {
public:
private:
static Bar mem1; //ok
Bar *mem2; //ok
Bar mem3; //error
}
a singleton example
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/dd7f3af258a800cd?hl=en
No comments:
Post a Comment