单项选择题

有如下程序:
#include<iostream>
using namespace std;
class Base
protected:
Base()cout<<’A’;
Base(char c)cout<<c;
;
class Derived:public Base
public:
Derived(char c)cout<<c;
;
int main()
Derived dl(’B’);
return 0;
执行这个程序的输出结果是()。

A.B
B.BA
C.AB
D.BB

<上一题 目录 下一题>
热门 试题

单项选择题
下列程序的输出结果是( )。#include<iostream.h>class Myclass {public:Myclass(int i=0,intj=0){ x=i;y=j;}void show( ) { cout < < x= < < x < < < y= < < y < < end1;}void show( )const { cout < < x= < < < < y=’’ < < y < < end1;}privated:int x; int y;};void main( ){ Myclass my1(3,4);const my2(7,8);my1.show( );my2.show( );}
A. x=4,y=3;x=7,y=8
B. x=3,y=4;x=7,y=8
C. x=7,y=8;x=4,y=3
D. x=8,y=7;x=7,y=8
单项选择题
下面程序的运行结果为( )。# include <iostream.h>class A{public:A( ) {cout << 1 ;}~A( ) {cout << 2 ;}};class B:public A{public:B( ) {cout << 3 ;} ~B ( ) {cout << 4 ;}};void main ( ){B b;}
A.1234
B.1324
C.1342
D.3142
相关试题
  • 下列程序的运行结果为()。 #include<i...