g*****1 发帖数: 998 | 1 【 以下文字转载自 Programming 讨论区 】
发信人: guagua1 (), 信区: Programming
标 题: 请教2道c++的题
发信站: BBS 未名空间站 (Tue Jan 10 19:21:47 2012, 美东)
class base{};
class derived{};
class derived2: public base, derived {};
which is true?
1) This is illegal
2) derived2 is derived public from base and private from derived
3) derived2 is derived public from base and public from derived
4) derived2 is derived public from base and protected from derived
class X{
public:
X& operator=(const X& rhs);
const X& operator+(const X&rhs) const;
const X& operator+(int m);
private:
int n;
};
int main(){
X a, b, c;
system("pause");
return 0;
}
which one is wrong?
a=c+5;
a=a=b+c;
(a=c+4)=b+2;
a=b+c;
b=a+1; | l*****a 发帖数: 14598 | 2 第一题选2
第二题选3?
【在 g*****1 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 【 以下文字转载自 Programming 讨论区 】 : 发信人: guagua1 (), 信区: Programming : 标 题: 请教2道c++的题 : 发信站: BBS 未名空间站 (Tue Jan 10 19:21:47 2012, 美东) : class base{}; : class derived{}; : class derived2: public base, derived {}; : which is true? : 1) This is illegal : 2) derived2 is derived public from base and private from derived
| F*******P 发帖数: 1 | | b******b 发帖数: 300 | 4 第二题是不是2?
。。。。。 觉得2是对的……我也找不到错误 |
|