单项选择题

下列有关模板的叙述中,正确的是______。

A.函数模板不能含有常规形参
B.函数模板的一个实例就是一个函数定义
C.类模板的成员函数不能是模板函数
D.用类模板定义对象时,绝对不能省略模板实参
<上一题 目录 下一题>
热门 试题

单项选择题
有如下程序: #include<iostream> using namespace std; class Base int x; public: Base(int n=0):x(n)cout<<n; int getX()constreturn x; ; class Derived:public Base mt y; public: Derived(int m,int n):y(m),Base(n)cout<<m; Derived(int m):y(m)cout<<m; ; int main() Derived d1(3),d2(5,7); return 0; 执行这个程序的输出结果是______。
A.375
B.357
C.0375
D.0357
单项选择题
有如下程序: #include<iostream> using namespace std; class CA public: virtual int f()return 1; ; class GB:public GA public: virtual int f()return 2; ; void show(GA g)cout<<g.f(); void display(GA &g)cout<<g.f(); int main() GA a;show(a);display(a); CB b;show(b);display(b); return 0; 执行这个程序的输出结果是______。
A.1111
B.1211
C.1112
D.1212
相关试题
  • 下面是一个模板声明的开始部分: template...
  • 下列语句都是程序运行时的第1条输出语句,...
  • C++系统预定义了4个用于标准数据流的对...