有如下类声明: class Base{ protected: int amount; public: Base(int n=0):araount(n){ } int getAmount( )const{retum amo

admin2013-02-27  19

问题 有如下类声明:    class Base{    protected:    int amount;    public:    Base(int n=0):araount(n){ }    int getAmount( )const{retum amount;}    };    class Derived:public Base{    protected;    int value;    public:    Derived(int m,int n):value(n1),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

解析
转载请注明原文地址:https://kaotiyun.com/show/ibNp777K
0

最新回复(0)