avatar
s*g
1
面完后给见面的人基本上都发了thank you email.只有几个人回复了,是不是意味着没
戏了?
avatar
c*e
2
void log(std::string message);
class Account {
public:
Account(int id);
virtual ~Account();
virtual std::string get_name()=0;
int get_id();
};
Account::~Account() { log("Destroying: " + get_name()); }
What is the problem with the sample code above?
a) The + operator in the destructor is illegal because the types of its
operands are different.
b) Destructors are only allowed to delete memory. Calling log is illegal.
c) It is not possible to write a subclass of Account because Ac
avatar
i*g
3
你都发了就行了,回不回有什么关系...
avatar
r*g
4
so hard... i will guess e...

【在 c**********e 的大作中提到】
: void log(std::string message);
: class Account {
: public:
: Account(int id);
: virtual ~Account();
: virtual std::string get_name()=0;
: int get_id();
: };
: Account::~Account() { log("Destroying: " + get_name()); }
: What is the problem with the sample code above?

avatar
s*g
5
这不是心悬着吗?

【在 i*g 的大作中提到】
: 你都发了就行了,回不回有什么关系...
avatar
j*i
6
It is not clear, seem only choice is e
but the statement is wrong, it is allowed to all get_name, but it will not
get the result you want, calling virtual function in the destructor and
constructor the vptr will not always point to corret class

【在 c**********e 的大作中提到】
: void log(std::string message);
: class Account {
: public:
: Account(int id);
: virtual ~Account();
: virtual std::string get_name()=0;
: int get_id();
: };
: Account::~Account() { log("Destroying: " + get_name()); }
: What is the problem with the sample code above?

avatar
i*g
7
嗯,理解,看开就好了。
avatar
M*5
8
这题答案是e
avatar
F*4
9
我一般只发给chair 好像也没影响
avatar
h*6
10
问题是,get_name是纯虚函数,这个类根本不允许有实例啊。
avatar
s*g
11
你给chair 发别人回复了吗
我这儿chair 倒是简短回信了,但是很多其他AP都没回。

【在 F*****4 的大作中提到】
: 我一般只发给chair 好像也没影响
avatar
M*o
12
You don't need to send a note to everyone.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。