由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 请教C++面试题
相关主题
为什么需要定义 = 和 copy ctorc++的对象管理符合邓小平理论:来料加工,两头在外
how to assign object rather and 'reference' to a python list?从无虚函数的基类到有虚函数的派生类
什么时候需要调用STL container的destructor?关于singleton 的面试题
相关话题的讨论汇总
话题: c++话题: classa话题: 面试题话题: allocated话题: instances
进入Programming版参与讨论
1 (共1页)
a****a
发帖数: 1264
1
今天面试被问了个问题,实在是不知道答案,请牛人们指点一下。谢谢
问题如下:
If I need to write a class, ClassA as part of a static library, then how can
I enforce that instances only be allocated on the stack, but not on the
heap, at compile-time?
t****t
发帖数: 6806
2
make operator new private

can

【在 a****a 的大作中提到】
: 今天面试被问了个问题,实在是不知道答案,请牛人们指点一下。谢谢
: 问题如下:
: If I need to write a class, ClassA as part of a static library, then how can
: I enforce that instances only be allocated on the stack, but not on the
: heap, at compile-time?

a****a
发帖数: 1264
3
Thanks again.

【在 t****t 的大作中提到】
: make operator new private
:
: can

1 (共1页)
进入Programming版参与讨论
相关主题
how to assign object rather and 'reference' to a python list?从无虚函数的基类到有虚函数的派生类
什么时候需要调用STL container的destructor?关于singleton 的面试题
c++的对象管理符合邓小平理论:来料加工,两头在外为什么需要定义 = 和 copy ctor
相关话题的讨论汇总
话题: c++话题: classa话题: 面试题话题: allocated话题: instances