由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - another c++ interview question
相关主题
问个INTERVIEW QUESTION问一个java基础的初始化的问题,一直搞不明白
弱问:C#定义的class里面直接new出来的成员存在了哪里?ThreadLocal可以这样用吗?
请教C++面试题static variable存在heap还是stack?
[c++] static function in a classC++ online Test 2题
再一个问题c++How to make sure that I get the original object or only a copy (not original) in such situation?
Global(static) variable initialization questionC++做题,麻烦师傅们再看看。
[合集] 为什么很少有人用static来实现signleton?请教goodbug等大神几个AWS的问题
c++ singleton questions请教高手一个C++问题
相关话题的讨论汇总
话题: enforce话题: compile话题: another话题: question话题: what
进入Programming版参与讨论
1 (共1页)
b***m
发帖数: 58
1
Here is another one, don't quiet understand what it is asked.
Suppose you're responsible for writing class MyClass as part of a static
library.
a) How do you enforce that a single instance of this class be used at
compile-time?
b) How do you enforce that instances only be allocated on the stack, but not
on the heap, at compile-time?
T*******i
发帖数: 4992
2
你应该多看看精华区或者mark的文章,再去面试

not

【在 b***m 的大作中提到】
: Here is another one, don't quiet understand what it is asked.
: Suppose you're responsible for writing class MyClass as part of a static
: library.
: a) How do you enforce that a single instance of this class be used at
: compile-time?
: b) How do you enforce that instances only be allocated on the stack, but not
: on the heap, at compile-time?

b***m
发帖数: 58
3

精华区有吗,能给个链接吗? 谢谢

【在 T*******i 的大作中提到】
: 你应该多看看精华区或者mark的文章,再去面试
:
: not

d***y
发帖数: 65
4
gg,还是自己去找找看吧~~
知道在哪里自己都懒得去找一下么?这应该自己去google简单点把?

【在 b***m 的大作中提到】
:
: 精华区有吗,能给个链接吗? 谢谢

b***m
发帖数: 58
5

not
搜不到啊

【在 b***m 的大作中提到】
: Here is another one, don't quiet understand what it is asked.
: Suppose you're responsible for writing class MyClass as part of a static
: library.
: a) How do you enforce that a single instance of this class be used at
: compile-time?
: b) How do you enforce that instances only be allocated on the stack, but not
: on the heap, at compile-time?

p***o
发帖数: 1252
6
a) singleton
b) private operator new/delete

【在 b***m 的大作中提到】
:
: not
: 搜不到啊

b***m
发帖数: 58
7

Well, these are what I was thinking first. What I am not sure are how they
are related to "static library" and "enforce on compile time" mentioned in
the question

【在 p***o 的大作中提到】
: a) singleton
: b) private operator new/delete

p***o
发帖数: 1252
8
Well, that means you don't really understand them.
Google and read those articles.

【在 b***m 的大作中提到】
:
: Well, these are what I was thinking first. What I am not sure are how they
: are related to "static library" and "enforce on compile time" mentioned in
: the question

1 (共1页)
进入Programming版参与讨论
相关主题
请教高手一个C++问题再一个问题c++
"brk()" 和 mmap() 有什么区别? (转载)Global(static) variable initialization question
a small question about c++ memory allocation[合集] 为什么很少有人用static来实现signleton?
关于C/C++里的Static variable的memory allocation/initializac++ singleton questions
问个INTERVIEW QUESTION问一个java基础的初始化的问题,一直搞不明白
弱问:C#定义的class里面直接new出来的成员存在了哪里?ThreadLocal可以这样用吗?
请教C++面试题static variable存在heap还是stack?
[c++] static function in a classC++ online Test 2题
相关话题的讨论汇总
话题: enforce话题: compile话题: another话题: question话题: what