主观

#include

class Base

{public:

Base(int x,int y)

{a=x;b=y;}

virtual void Show(){cout<<"Base:"<

private:

int a,b;

};

class Derived:public Base

{public

Derived(int x,int y,int z):Base(x,y),c(z){}

void Show(){Base::show();cout<<"Derived:"<

private:

int c;

};

void main()

{Base b(10,20);

Base *ref=&b

Derived d(30,60,90);

ref->Show()

cout<

ref=&d;

ref->show();

}

参考答案
您可能感兴趣的试题
¥

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服