z****e 发帖数: 2024 | 1 class s{
private:
static s objs;//with a concrete member object.
s(){}
s(const s&);
s& operator=();
public:
static s& Create(){return objs;}
....
};
class A{
private:
A objA;//error!
public:
A(){}
};
why, non-static member object type can not be the class itself, but static can?
or my observation is wrong?
my reasoning is that: static is NOT part of the class s (in terms of memory initilization), the static concrete member object only use the class s as a namespace and class s only constraints t | t****t 发帖数: 6806 | 2 your understanding is correct.
【在 z****e 的大作中提到】 : class s{ : private: : static s objs;//with a concrete member object. : s(){} : s(const s&); : s& operator=(); : public: : static s& Create(){return objs;} : .... : };
| z****e 发帖数: 2024 | 3 thanks. master shifu.
【在 t****t 的大作中提到】 : your understanding is correct.
|
|