分析下列程序,写出程序运行结果。#includeusing namespace std;class A{protected:int x;public:A() { x=0; }A(int a) { x=a;}};class B:public A{int y;public:B(int a,int b):A(b){y=a;}B(int a) { y=a; }void print() { cout<
查看答案
分析下列程序,写出程序运行结果。#includeusing namespace std;class A{protected:int a;public:A(int x=10){a=x;}virtual void print() { cout<
分析下列程序,写出程序运行结果____。#includeusing namespace std;class A{public:virtual void f( ){cout<<1; }void g( ){ cout<<2; }};class B: public A {public:virtual void f( ){ cout<<3; }void g( ){ cout<<4; }};void show( A &a) { a.f( ); a.g( ); }void print(A *p){ p->f(); p->g();}int main(void){B b;show(b);print(&b);cout<
分析下列程序,写出程序运行结果。#includeusing namespace std;class A{protected:static int num;public:A( ){ num++; cout<
分析下列程序,写出程序运行结果。#includeusing namespace std;class A{protected:static int num;public:A( ){ num++; cout<