#include
using namespace std;
class base
{
private: int x;
public: base(int a){x=a;}
int get( ){return x;}
void showbase( ) {cout<<"x="< }; class Derived: public base {private: int y; public: Derived(int a,int b): base(a){y=b;} void showderived( ) {cout<<"x="< }; void main( ){ base b(3); Derived d(6,7); b.showbase( ); d.showderived( ); ___________; b.showbase( ); ___________; b1.showbase( ); base* pb=&b1; pb->showbase( ); d.showderived( ); b.showbase( ); } 输出结果如下: x=3 x=6,y=7 x=6 x=6 x=6 x=6,y=7 x=6
订单号:
遇到问题请联系在线客服
订单号:
遇到问题请联系在线客服