填空题

多数运算符既能作为类的成员函数重载,也能作为类的非成员函数重载,但[]运算符只能作为类的______函数重载。

【参考答案】

成员
<上一题 目录 下一题>
热门 试题

填空题
在下面程序的横线处填上适当的语句,使该程序的输出为12。#include <iostream>using namespace std;class Base{public:int a;Base(int i){ a=i; }class Derived : public Base{int a;public:Derived(int x) : Base(x),b(x+1){}void show(){______; 输出基类数据成员a的值cout<<b<<endl;}};int main (){Derived d(1);d.show();return 0;}
填空题
下列程序将x、y和z按从小到大的顺序排列,请将下面的函数模板补充完整。template <class T>void order(______){T a;if (x>y){a=x; x=y; y=a;}if (y>z){a=y; y=z; z=a;}if (x>y){a=x; x=y; y=a;}}
相关试题
  • 下面是一个栈类的模板,其中push函数将元素...
  • 非成员函数应声明为类的______函数才...