题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-21 19:23:50

[填空题]下列程序中的重载函数disp( )发生错误,错误原因是 【13】
# include<iostream, h>
class Sample

private:
int m;
static int sr;
public:
Sample(int a) m=a; st+=a;
static void disp( )cout<<m<<end1;
static void disp(Sample input)

cout<<input. m<<end1;

;
int Sample: : st=2;
void main( )

Sample Eirst(2), Second(4)
Sample: :disp( );
Sample: :disp (Second);

更多"下列程序中的重载函数disp( )发生错误,错误原因是 【13】 。 "的相关试题:

[填空题]下列程序中的重载函数disp( )发生错误,错误原因是______。
#include<iostream.h>
class Sample

private:
int m;
static int st;
public:
Sample(int a)m=a;st+=a;
static void disp( )cout<<m<<endl;
static void disp(Sample input)

cout<<input.m<<endl;;
int Sample::st=2;
void main( )

Sample First(2),Second(4);
Sample::disp( );
Sample::disp(Second);

[填空题]如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为 【8】 。 # include<iostream.h> class test { private: int num; public: test(int) void show( ); }; test: :test(int n){ num=n;} test:: show( ) { cout<<num<<end1; } void main( ) { test T(10); T. show ( ); }
[填空题]如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为 【8】
# include<iostream.h>
class testprivate:
int num;
public:
test(int)
void show( );
;
test: :test(int n) num=n;
test:: show( ) cout<<num<<end1;
void main( ) test T(10);
T. show ( );

[填空题]如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为______。
#include<iostream.h>
class test

private:
int hum;
public:
test(int);
void show( );
;
test::test(int n)num=n;
test::show( )cout<<num<<endl;
void main( )

test T(10):
T.show( );

[单项选择]下列对重载函数的描述中,( )是错误的。
A. 重载函数中不允许使用默认参数
B. 重载函数中编译是根据参数表进行选择
C. 不要使用重载函数来描述毫无相干的函数
D. 构造函数重载将会给初始化带来多种方式
[单项选择]在下面的运算符重载函数的原型中,错误的是( )。
A. Volume operator-(double,double);
B. double Volume::operator-(double);
C. Volume Volume::operator-(Volume);
D. Volume operator-(Volume);
[单项选择]对定义重载函数的下列要求中,( )是错误的。
A. 要求参数的个数不同
B. 要求参数中至少有一个类型不同
C. 要求参数个数相同时,参数类型不同
D. 要求函数的返回值不同
[填空题]类class one 在声明func 成员函数时发生错误,出错原因是 【9】
Class one

private:
int a;
public:
void func(two& )
;
class two

private:
int b;
friend void one: :func(two & );
;
void one: : func(two& r)
a=r.b;

[填空题]下列程序的输出是3,请填充程序中的空缺,使该行形成一个运算符重载函数的定义。   #include   using namespace std;   class MyNumber{   int n;   public:   MyNumber(int k):n(k){}   _【9】_int()const{return n,}   };   int main(){   MyNumber numl(3);   Cout<
[填空题]重载函数的函数名称相同,但函数的实现和功能不同,系统是靠 【12】 来决定采用哪个函数。
[填空题]一个双目运算符作为类的成员函数重载时,重载函数的参数表中有()个参数。
[填空题]类clasg one在声明func成员函数时发生错误,出错原因是______。
class one
private:
int a;
public:
void func(two&);
;
class two

private:
int b;
friend vold one::func(two&);
;
void one::func(two&r)

a=r.b;

[填空题]函数重载要求重载的函数必须有和原函数一样的【 】。

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码