填空题
已知:double A(double A) {return ++a;}和int A(int A) {return++a;}是一个函数模板的两个实例,则该函数模板定义为
【13】
【参考答案】
template<typename T>
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
有以下程序:#include<iostream.h>classA{int x;public:A(int A) {x=a;}friend class B;};class B{public:void print(AA) {a.x--;cout<<a.x<<end1;}};void main(){Aa(10);Bb;b.print(A) ;}程序执行后的输出结果是 【14】 。
点击查看答案&解析
填空题
下面是“二维向量”vector2D的定义,其中作为成员函数重载的运算符“+”的功能是将两向量的分量x和y对应相加,然后返回作为相加结果的新对象;请填空补充完整。class vector2D{double x; x分量double y; y分量public:vector2D(double x0=0,double y0=0):x(x0),y(y0){}void show(cout<<’(’<<’,’<<y<<’)’;}vector2D operator+(vector2D) ;};【11】 operator + (vector2D A) {return vector2D( 【12】 );}
点击查看答案&解析
相关试题
下面程序的输出结果是 【15】 。#incl...