单选题
有如下程序: #inc1ude<iostream> using namespace std; c1ass XX{ int x; public: XX(int xx=0):x(xx){} int getX(){return x;) }; c1ass YY: public XX{ int y; public: YY(int xx, int yy):XX(xx),y(yy){} int getV(){retum getX()+y;} }; int main(){ YY c(3,4); cout<<c.getV()+c.getXO<<end1; return 0; } 运行这个程序的输出结果是( )。
【正确答案】
D
【答案解析】解析:由于类YY公开继承自类XX,所以执行表达式c.getVO+c.getXO的值等于3+3+4=10。