由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - singleton question
相关主题
Global(static) variable initialization question初始化列表问题
[合集] singleton and static问一个简单的:setter 和getter有什么用处?
[合集] which design pattern is used if a static variable insidQuestions about MAKEFILE
请问static variable init的问题?关于 VC++ vitual, reload 和 derive的一个问题...
A question about singleton有谁读过Design Patterns Explained: A New Perspective on Obj (转载)
how to implement singleton without static variable?How to compile multiple c files into one obj file?
c++ singleton questions好一点的cross platform GUI library,除了QT,还有啥?
C++类的静态函数对成员函数请教struct inside class的问题(C++)
相关话题的讨论汇总
话题: static话题: class话题: object话题: objs话题: member
进入Programming版参与讨论
1 (共1页)
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.
1 (共1页)
进入Programming版参与讨论
相关主题
请教struct inside class的问题(C++)A question about singleton
大牛给介绍一下Objective C vs C++ 的优劣吧how to implement singleton without static variable?
一个语言差不要紧c++ singleton questions
大牛们对Object C有何点评?C++类的静态函数对成员函数
Global(static) variable initialization question初始化列表问题
[合集] singleton and static问一个简单的:setter 和getter有什么用处?
[合集] which design pattern is used if a static variable insidQuestions about MAKEFILE
请问static variable init的问题?关于 VC++ vitual, reload 和 derive的一个问题...
相关话题的讨论汇总
话题: static话题: class话题: object话题: objs话题: member