A-A+

有如下程序:#include <iostream>using namespace std;c

2022-08-06 01:43:48 问答库 阅读 174 次

问题详情

有如下程序:#include <iostream>using namespace std;class Base{private: char c;public: Base(char n):c(n){} ~Base() { cout<<c; }};class Derived: public Base{private: char c;public: Derived(char n):Base(n+1),c(n){} ~Derived() { cout<<c; }};int main(){ Derived obj("x"); return 0; }执行上面的程序将输出()。
A.xy
B.yx
C.x
D.y请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:A

考点:程序