使用VC6打开考生文件夹下的工程test25_1,此工程包含一个源程序文件test25_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:
privatel from derived1:30
privatel from derived2:30
源程序文件test25_1.cpp清单如下:
/***************found******************/
include<iostream.h>
class base
protected:
int privatel;
public:
base(int p)privatel=p;
;
/****************found*******************/
class derived1:public base
public:
derivedl(int p1):base(p1);
int get_private()return private1;
class derived2:virtua1 public base
public:
derived2(int p2):base(p2);
int get_private()return private1;
;
class derived12:public derived1,public derived2
public:
/****************found*******************/
derived12(int p1,int p2,int pb):derived1(p1), base(pb), derived2(p2);
;
void main()
derived12 d(10,20,30);
cout<<"privatel from derived1:"<<d.derived1::get_private();
cout<<"\nprivatel from derived2:"<<d.derived2::get_private();
cout<<endl;