有如下类声明:
class Base
protected:
mt amount;
public:
Base(int n=0):amount(n)
int getAmount( )constreturn amount;
;
class Derived:public Base
protected:
int value;
public:
Derived(int m,int n):value(m),Base(n)
int getData( ) constreturn value+amount;
;
已知x是一个Derived对象,则下列表达式中正确的是______。
A:x.value+x.getAmount() B:x.getData()-x.getAmount() C:x.getData()-x.amount D:x.value+x.amount
有下列程序:
#include<iostream>
Using namespace std;
Class Amount
int amount;
public;
Amount(int n=O):amount(n)
Int getAmount( )constreturn amount;
Amount &operator+=(AmountA)
amount+=a.amount;
return
;
int main( )
Amount x(3),y(7);
x+=y;
cout<<x.getAmount( )<<endl;
return 0;
己知程序的运行结果是10,则横线处缺失的表达式是( )。
A:*this B:this C:&amount D:amount
有下列程序:
#include<iostream>
Using namespace std;
Class Amount
int amount;
public;
Amount(int n=O):amount(n)
Int getAmount( )constreturn amount;
Amount &operator+=(Amount
A:
amount+=a.amount;
return
;
int main()
Amount x(3),y(7);
x+=y;
cout<<x.getAmount()<<endl;
return 0;
己知程序的运行结果是10,则横线处缺失的表达式是( )。A) *this B:this C:&amount D:amount
有如下程序:
#include<iostream>
using namespace std;
class Amount
int amount;
public:
Amount(int n=0):amount(n)
int getAmount( )constreturn amount;
Amount&operator+=(Amount
A:
amount+=a.amount;
return;
;
int main( )
Amount x(3),y(7);
x+=y:
cout<<x.getAmount( )<<endl;
return 0;
已知程序的运行结果是10,则下画线处缺失的表达式是A) *this B:this C:&amount D:amount
有如下程序: #include<iostream> using namespace std; class Amount{ int amount; public: Amount(int n=0):amount(n){ } int getAmount( )const{return amount;} Amount&operator+=(Amount A) { amount+=a.amount; return; } }; int main( ){ Amount x(3),y(7); x+=y: cout<<x.getAmount( )<<endl; return 0; } 已知程序的运行结果是10,则下画线处缺失的表达式是
A:*this B:this C:&amount D:amount
有如下程序:
#include<iostream>
using namespace std;
class Amount{
int amount;
public:
Amount(int n=0):amount(n){}
int getAmount( )const{return amount;}
Amount&operator9=(Amount a){
amount+=a. amount;
return______;
}
};
int main( ){
Amount x(3),y(7);
x+=y,
cout<<x. getAmount( )<<endl;
return 0;
}
已知程序的运行结果是10,则下划线处缺失的表达式是
A:* this B:this C:&amount D:amount
有如下类的声明:
class Base{
protected:
int amount;
public:
Base(int n=0):amount(n){}
int getAmount( )const{return amount;}
};
class Derived:public Base{
protected:
int value
public:
Derived(int m,int n):value(m),Base(n){}
int getData( )const{return value+amount;}
};
已知x是一个Derived对象,则下列表达式中正确的是
A:x. value+x. getAmount() B:x. getData()-x. getAmount() C:x. getData()-x. amount D:x. value+x. amount
有如下程序: #include<iostream> Using namespace std; Class Amount{ int amount; public; Amount(int n=0):amount(n){} Int getAmount( )const{return amount;} Amount &operator+=(Amount a){ amount+=a.amount; return______; } }; int main( ){ Amount x(3),y(7); x+=y; cout<<x.getAmount( )<<endl; return 0; } 已知程序的运行结果是10,则横线处缺失的表达式是( )。
A:*this B:this C:&amount D:amount
有下列程序: #include<iostream> Using namespace std; Class Amount{ int amount; public; Amount(int n=O):amount(n){} Int getAmount( )const{return amount;} Amount &operator+=(AmountA) { amount+=a.amount; return } }; int main( ){ Amount x(3),y(7); x+=y; cout<<x.getAmount( )<<endl; return 0; } 己知程序的运行结果是10,则横线处缺失的表达式是( )。
A:*this B:this C:&amount D:amount