问答题

{{*HTML*}}给出下面程序输出结果。
#include <iostream.h>
class Base
{ private:
int Y;
public:
Base ( int y = 0 ) { Y = y; cout<<"Base ("<<y<<" ) \ n"; }
~Base() { cout<<"~Base()\n" ;}
void print() { cout<<Y<<" " ; }
};
class Derived:public Base
{private:
int Z;
public:
Derived(int y, int z):Base(y)
{Z=z;
cout<<"Derived("<<y<<", "<<z<<")\n";
}
~Derived(){cout<<"~Derived()\n"; }
void print()
{Base::print();
cout<<Z<<endl;
}
};
void main()
{Derived d(10, 20);
d.print();
}

【参考答案】

此题暂无答案,小编努力补充中……