单选题 C++
题号 #2607035

下列关于类模板的模板参数的叙述中,错误的是(    )。

进入在线模考

参考答案

D

答案解析

本题考查类模板的概念和定义,模板参数可以作为成员函数的局部变量的类型。

你可能感兴趣的试题

A.Cin是C++预定义的标准输入流对象
B.Cin是C++预定义的标准输入流类
C.Cout是C++预定义的标准输入流对象
D.Cout是C++预定义的标准输入流类
3

请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl,其中有枚举DOGCOLOR、狗类Dog和主函数main的定义。程序中位于每个“//ERROR ****found****”下的语句行有错误,请加以改正。改正后程序的输出结果应该是:
There is a white dog named Hoh0.  There is a blaCk dog named Haha.  There is a motley dog named Hihi.  注意:只修改每个//ERROR****found****女料下的那一行,不要改动程序中的其他内容。
#inClude<iostream>  using namespaCe std;  //狗的颜色:黑、白、黄、褐、花、其他
enum DOGCOLOR{BLACK,WHITE,YELLOW,BROWN,PIEBALD,OTHER};  Class Dog{//狗类
DOGCOLOR Color;    Char name[20];    statiC int Count;  publiC:
Dog(Char nalTle[],DOGCOLOR Color){    strCpy(this一>name,name);
//ERROR**********found**********、
strCpy(this一>Color,Color);
}    1    DOGCOLOR getColor()Const{retum Color;}
//ERROR**********found**********
Const Char * 9etName()Const{return*finin9;}        Const Char * 9etColorString()Const{
switCh(Color){
Case BLACK:return”blaCk“;    Case WHITE:return”white”:
Case YELLOW:return’"yellow”:    Case BROWN:return”brown”;    ease PIEBALD:return”piebald”:
}
return”motley”;
}
void show()Const{    .    Cout<<”There is a”<<getColorString()<<”dog named’’<<name<<’.’<<endl;
}    };    int main(){
//ERROR**********found**********
Dog dogl(”Hoh0”,WHITE),dog2(”Haha”,BLACK);d0g3(”Hihi”,0THER);    d091.show();
dos2.show();    dos3.show();    return 0;
}

找试题 · 找答案 · 找资料 在线模考