问题

有如下函数模板:

template

T cast(U u){return u;}

其功能是将 U 类型数据转换为 T 类型数据。已知 i 为 int 型变量,下列对模板函数 cast 的调用中正确的是

A . cast(i);

B . cast$amp;C . cast(i);

D . cast (i);

参考答案
您可能感兴趣的试题
  • 若磁盘上已存在某个文本文件,其全路径文件名为 d:\ncre\test.txt ,下列语句中不 能打开该文件的是A . ifstream file(d:\ncre\test.txt) ;B . i
  • 有如下类定义:class Foo{public:Foo(int v):value(v){} // ①~Foo(){} // ②private:Foo(){} // ③int value = 0; //
  • 有如下类定义:class Point{int x_, y_;public:Point():x_(0), y_(0){}Point(int x, int y = 0):x_(x),y_(y){}};若执
  • 有如下类定义:class Test{public:Test(){ a = 0; c = 0;} // ①int f(int a)const{this->a = a;} // ②static int g
  • 有如下程序:#includeusing namespace std;class A{public:A(){cout$amp;~A(){cout$amp;};class B:public A{A* p;
  • 有如下程序:#includeusing namespace std;class Base{private:void funl() const{cout$amp;protected:void fun2(