else
{
float y;
cout<<"请输入存款数量:";
cin>>y;
p->Withdrawal(y);
}
}
}
//类似 if (i==2)
}
}
第17章
//************
//***17.1*****
//*Daiyuebing*
//************
# include <iostream.h>
class A
{
public:
A()
{
pA=0;
}
int GetpA()
{
return pA;
}
void SetpA(int a)
{
pA=a;
}
private:
int pA;
};
class B:virtual public A
{
public:
int OnB()
{
return GetpA();
}
};
class C:virtual public A,public B
{
int Sc()
{
return GetpA();
}
};
void main()
{
A x;
B y;
C z;
cout<<x.GetpA()<<endl;
cout<<y.GetpA()<<endl;
cout<<z.GetpA()<<endl;
}
//************
//***17.2*****
//*Daiyuebing*
//************
class father
{
public:
drive();
protected:
repareTV();
};
class mother
{
public:
song();
private:
work();
};
class child:public father,public mother
{
public:
playtable();
};
/*修改
protected:
repareTV();
为
public:
repareTV();
*/