有如下程序:#include<iostream>;classToy

11 查阅

有如下程序:#include<iostream>;classToy

{

public:

Toy(char_n)

{strcpy(name,_n);count++;}

~Toy(){count–;}

charGetName()

{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.运行时出错

参考答案:

答案:3