有如下程序,运行这个程序的输出结果是。#inclu
有如下程序,运行这个程序的输出结果是()。
#include<iostream>
using namespace std;
class XX{
int x;
public:
XX(int xx=0):x(xx){}
int getX() {return x;}
};
class YY: public XX{
int y;
public:
YY(int xx, int yy):XX(xx),y(yy){}
int getV() {return getX()+y;}
};
int main(){
YY c(3,4);
cout<<c.getV()+c.getX()<<endl;
return 0;
}答案
D