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

选择题

99. 有如下程序: #include<iostream> #include<string> using namespace std; class Person{ public: Person(string n):name(n) { cout<<'1' ; } private: string name; }; class Date{ public: Date(int y=2012):year(y) { cout<<'2'; } private: int year; }; class Student:public Person{ public: Student(string n, int y, char c):birthday(y), sex(c), Person(n) { cout<<'3'; } private: Date birthday; char sex; }; int main(){ Student stu1("321",2002,'2'); return 0; } 运行时的输出结果是______。

上一题下一题