问题
单项选择题
有如下类的声明:class Base{protected: int amount;public: Base(int n=0):amount(n){} int getAmount()const{return amount;}};class Derived:public Base{protected: int valuepublic: 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
答案
参考答案:B