由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - one c++ questions
相关主题
弱问:singleton要不要destructor啊?Onsite失败,说几个面试中有印象的问题。
问两道C++的面试题目包子呼唤大牛--问关于C++Destructor的问题 (转载)
One C++ question问个C++重新编译的问题
问个c++的问题Bloomberg(financial software developer)第一轮面试
C++ Q52: (C6)C++面试问题,高人请进啊~~~
C++ online Test 一题请教1个工作面试题
说说找工作的体会为什么C++的constructor出错可以抛出异常,而destructor出错
新Qualcomm面经找工作总结(CS)
相关话题的讨论汇总
话题: c++话题: instance话题: class话题: when话题: questions
进入JobHunting版参与讨论
1 (共1页)
m******r
发帖数: 61
1
I have one class. in order to make my application only have one instance of
this class,
I define a static count, when contructor is called the counter will ++.
my question is when counter >1, how class will destroy itself, when second
instance is trying to create.
Can I call destructor from constructor
except static variable, do we have other way to keep only one copy in my
application?
Thanks so much.
y*******g
发帖数: 6599
2
google singleton

of

【在 m******r 的大作中提到】
: I have one class. in order to make my application only have one instance of
: this class,
: I define a static count, when contructor is called the counter will ++.
: my question is when counter >1, how class will destroy itself, when second
: instance is trying to create.
: Can I call destructor from constructor
: except static variable, do we have other way to keep only one copy in my
: application?
: Thanks so much.

Q******e
发帖数: 85
3
check more effective C++, how to limit the number of instance.
s****g
发帖数: 56
4
singleton for sure.
I don't think you can call dtr from ctr.
before ctr finishes, the object does not exist, yet.

of

【在 m******r 的大作中提到】
: I have one class. in order to make my application only have one instance of
: this class,
: I define a static count, when contructor is called the counter will ++.
: my question is when counter >1, how class will destroy itself, when second
: instance is trying to create.
: Can I call destructor from constructor
: except static variable, do we have other way to keep only one copy in my
: application?
: Thanks so much.

1 (共1页)
进入JobHunting版参与讨论
相关主题
找工作总结(CS)C++ Q52: (C6)
问一道c++的题C++ online Test 一题
问个C++题说说找工作的体会
One C++ question新Qualcomm面经
弱问:singleton要不要destructor啊?Onsite失败,说几个面试中有印象的问题。
问两道C++的面试题目包子呼唤大牛--问关于C++Destructor的问题 (转载)
One C++ question问个C++重新编译的问题
问个c++的问题Bloomberg(financial software developer)第一轮面试
相关话题的讨论汇总
话题: c++话题: instance话题: class话题: when话题: questions