C++ Logo
C++二级在线二级在线
首页选择题程序题成为会员帮助其他科目

选择题

74. 假设已包含 <iostream>、<string>,且 std::cout、std::string 可直接写为 cout、string。有如下类定义: class Person{ public: Person(string s):name(s) {cout<<name; } protected: string name; }; class Father: public Person{ public: Father(string s):Person(s) {cout<<name<<"A";} }; class Mother: public Person{ public: Mother(string s):Person(s) {cout<<name<<"B"; } }; class Child:public Father, public Mother{ public: Child(string s1,string s2):Mother(s1), Father(s2) { } }; 若执行语句 Child r1("1","2"); 则输出结果是______。

上一题下一题