由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - C++ Q65: recompiling (IB)
相关主题
问个C++重新编译的问题one C++ question?
请教1个工作面试题virtual destructor (C++)问题
一道面试的选择题问几个跟C++有关的面试题
a c++ interview question新Qualcomm面经
这个题目的讨论的结论是什么包子呼唤大牛--问关于C++Destructor的问题 (转载)
c++ vs Java virtual 实现(Y家)C++面试问题,高人请进啊~~~
virtual destructor的地址在virtual table里面吗?为什么C++的constructor出错可以抛出异常,而destructor出错
C++ online Test 一题One C++ question
相关话题的讨论汇总
话题: add话题: member话题: c++话题: libraries
进入JobHunting版参与讨论
1 (共1页)
c**********e
发帖数: 2007
1
You have a class that many libraries depend on. Now you need to modify the
class for one application. Which of the following changes require
recompiling all libraries before it is safe to build the application?
a) add a constructor
b) add a data member
c) change destructor into virtual
d) add an argument with default value to an existing member function
This is an old question. I believe that it was discussed before. But I am
still not sure about its answer.
w****r
发帖数: 1384
2
c

【在 c**********e 的大作中提到】
: You have a class that many libraries depend on. Now you need to modify the
: class for one application. Which of the following changes require
: recompiling all libraries before it is safe to build the application?
: a) add a constructor
: b) add a data member
: c) change destructor into virtual
: d) add an argument with default value to an existing member function
: This is an old question. I believe that it was discussed before. But I am
: still not sure about its answer.

t*****j
发帖数: 1105
3
选c是因为会改变其他子类的vtable,所以要重编译,对吗?
n******n
发帖数: 12088
4
因为abd都不对。

【在 t*****j 的大作中提到】
: 选c是因为会改变其他子类的vtable,所以要重编译,对吗?
s****a
发帖数: 528
5
b
s****a
发帖数: 528
6
add data member will change the memory size of the object. and even
arrangement of the data member.
t*****j
发帖数: 1105
7
其实我也倾向选b。呼唤正确答案!

【在 s****a 的大作中提到】
: add data member will change the memory size of the object. and even
: arrangement of the data member.

m*****n
发帖数: 2152
8
如果这个class原来没有virtual function, 现在加了一个,object size也是变化的因为多了
vtable,这样和b的情况一样了。
c**********e
发帖数: 2007
9
呼唤xnxky and thrust两位高手!

【在 t*****j 的大作中提到】
: 其实我也倾向选b。呼唤正确答案!
s*****n
发帖数: 5488
10
C++必须转化成C.如果数据变了对于其他lib没有任何影响,不需要重新compile,ld.
但是函数的signature变了。则必须重新编译才能知道正确的接口。所以只能是b.

【在 s****a 的大作中提到】
: add data member will change the memory size of the object. and even
: arrangement of the data member.

t*****j
发帖数: 1105
11
我觉得我思路可能错了,vtable应该是实例中才有的,也就是运行时候才有,和编译没
有关系。
这么排除下来应该还是b。

的因为多


【在 m*****n 的大作中提到】
: 如果这个class原来没有virtual function, 现在加了一个,object size也是变化的因为多了
: vtable,这样和b的情况一样了。

d**e
发帖数: 6098
12
http://www.mitbbs.com/bbsann2/life.faq/JobHunting/17/D12842543542i0/M.1284348203_2.70/%CE%CA%B8%F6C%2B%2B%D6%D8%D0%C2%B1%E0%D2%EB%B5%C4%CE%CA%CC%E2

【在 c**********e 的大作中提到】
: You have a class that many libraries depend on. Now you need to modify the
: class for one application. Which of the following changes require
: recompiling all libraries before it is safe to build the application?
: a) add a constructor
: b) add a data member
: c) change destructor into virtual
: d) add an argument with default value to an existing member function
: This is an old question. I believe that it was discussed before. But I am
: still not sure about its answer.

1 (共1页)
进入JobHunting版参与讨论
相关主题
One C++ question这个题目的讨论的结论是什么
面经: bloomberg 电面c++ vs Java virtual 实现(Y家)
C++相关的面经virtual destructor的地址在virtual table里面吗?
小公司web server面经C++ online Test 一题
问个C++重新编译的问题one C++ question?
请教1个工作面试题virtual destructor (C++)问题
一道面试的选择题问几个跟C++有关的面试题
a c++ interview question新Qualcomm面经
相关话题的讨论汇总
话题: add话题: member话题: c++话题: libraries