单项选择题

有如下程序:
#include<iostream>
using namespace std;
class C1
public:
~Cl( )cout<<1;
;
class C2:public C1
public:
~C2( )cout<<2;
;
int main( )
C2 cb2;
C1*cb1:
return 0;

程序的输出结果是

A.121
B.21
C.211
D.12
<上一题 目录 下一题>
热门 试题

单项选择题
有如下程序: #include<iostreanl> using namespaee std; class AA public: AA( )cout<<’1’; ; class BB:public AA int k; public: BB( ):k(0)eout<<’2’; BB(int n):k(n)cout<<’3’; ; int main( ) BB,b(4),c; return 0; 程序的输出结果是
A.1312
B.132
C.32
D.1412
单项选择题
有如下程序: #include<iostream> using namespace std; class Toy public: Toy(char*_n)strcpy(name,_n);count++; ~Toy()count--; char*GetName( )return name; static int getCount( )return count; private: char name[10]; static int count; ; int Toy::count=0: int main( ) Toy tl( Snoopy ),t2( Mickey ),t3( Barbie ); cout<<t1.getCount( )<<endl; return 0; 程序的输出结果是
A.1
B.2
C.3
D.运行时出错
相关试题
  • 有如下类定义: class Sample public:...
  • 有如下程序: #include<iostream> usi...
  • 如下程序定义了“单词”类word,类中重载了...
  • 请将下列模板类Data补充完整。 template ...
  • “图形”类Shape-中定义了纯虚函数calArea...