题目内容:
有如下程序: #include<iostream>
usingnamespacestd;
classToy{
public:
Toy(char*_n){strcpy(name,_n);count++;)
~Toy( ){count一一;)
char*GetName( ){returnname;}
staticintgetCount( ){returncount;)
private:
charname[10];
staticintcount;
};
intToy::count=0;
intmain( ){
Toyt1("snoopy"),t2("Mickey"),t3("Barbie");
cout<<t1.getCount( )<<endl:
return0;
)
运行时的输出结果是( )。 A.1
B.2
C.3
D.运行时出错
参考答案:
答案解析: