单项选择题
下面关于继承机制的描述中,不正确的是( )。
A.派生类不仅可以继承基类的成员,也可以添加自己的成员
B.设置protected成员是为派生类访问基类成员之用
C.采用不同的继承方式,将限制派生类对基类成员的访问
D.采用私有继承,派生类只能得到基类的公有成员
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序: #include <iostream> #include <string> using namespace std; int main () char s[]= n123 ; cout<<strlen (s) << , <<sizeof (s) <<end1; return 0;
A.赋初值的字符串有错
B.6,7
C.5,6
D.6,6
点击查看答案&解析
单项选择题
为了使程序的输出的正确结果为: Now is 2004.7.10 10:10:10. 那么应在下列程序划线处填入的正确语句是( )。 那么应在下列程序划线处填入的正确语句是( )。 #include <iostream> using namespace std; class TIME; class DATE public: DATE(int y=2004,int m=1,int d=1) year=y; month=m; day=d; friend void DateTime(DATE &d, TIME &t); private: int year, month, day; ; class TIME public: TIME(iht h=0, int m=0,int s=0) hour=h; minute=m; second=s; friend void DateTime(DATE &d,TIME &t); private: int hour,minute, second; ; ______________________ 函数 DateTime 的首部 cout<< Now is <<d.year<<’.’<<d.month<<’.’<<d.day<< ’ ’<<t.hour<< : <<t.minute<<’:’<<t.second<<’.’<<end1; int main ( ) DATE d(2004,7,10); TIME t(10, 10, 10); DateTime(d,t); return 0;
A.void DateTime(DATE &d,TIME &t)
B.void TIME::DateTime(DATE &d,TIME &t) const
C.friend void DateTime(DATE &d,TIME &t)
D.void DATE::DateTime(DATE &d,TIME &t)
点击查看答案&解析
相关试题
若有以下程序段: #include <iostream...
若有以下程序: #include <iostream>...
有以下程序: #include <iostream> u...
若有以下程序: #include <iostream>...
若有如下程序: #include <iostream>...