小青年装B必聊的9部电影(zz) (转载)# Joke - 肚皮舞运动
g*1
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;
发信人: 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;