王老师:19139051760(微信同号)  13333709510
联大   青书学堂   文才   和学   现代兴业   安徽教育在线   超星   弘成   广东开放大学   国家开放大学   上海开放大学   含弘慕课 

教育服务

成人高校
成考录取分数线
我要提升学历
提升学历的理由:
升职加薪、积分落户、考研、公务员考试、子女入学、出国留学


成人高考报名入口

当前位置: 首页 > 联大系统 > 河南财经政法大学> 河南财经大学数据库基础与应用
 

输入试题:
本题添加时间:2024/9/3 9:06:00
圆梦客服:王老师  19139051760(微信同号)  19139051760(微信同号)
#include

using namespace std;

class base

{

private:int x;

public:base(int a){x=a;}

int get(){return x;}

void showbase() {cout<<"x="<<><>< strong="">


};

class Derived:public base

{private:int y;

public:Derived(int a,int b):base(a){y=b;}

void showderived()

{cout<<"x="<<>< strong="">


};

void main()

{

base b(3);

Derived d(6,7);

b.showbase();

d.showderived();

b=d;

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

答案是:Derived b1(d);(或Derived b1(6,7); 或base b1(6);或 base b1(d);)


出自 河南财经大学数据库基础与应用  联大系统

河南财经政法大学

更多试题>>>>
1、完成下面程序,使其输出l0,并在退出运行时正确释放分配给指针的存储空间。 #include using namespace std; void main() { int *a,*p; a=new int(
2、给出下面程序的输出结果 #include using namespace std; class Simple { int x,y; public: Simple(){x=y=
3、给出下面程序的输出结果 #include using namespace std; void main() { int num=300; int &ref=num;
4、静态成员函数没有( ) A.返回值 B.this指针 C.指针参数 D.返回类型
5、要禁止修改指针p本身,又要禁止修改p所指向的数据,这样的指针应定义为( ) A.const char *p=“ABCD”; B.char const *p=“ABCD”; C.char *const p=“ABCD”; D.cons


提升学历-成人高考报名入口 提升学历-成人高考院校名单