//结果:
//small=2
//small=3
//small=2
#include <iostream.h>
class CRoot
{
public:
int small;
CRoot()
{
small=2;
}
CRoot(int n) //重载
{
small=n;
}
void showsmall()
{
cout<<"small="<<small<<endl;
}
};
class CDer1:public CRoot
{
public:
CDer1(int m):CRoot(m){}
};
class CDer2:public CRoot
{
public:
int small;
CDer2(int n=0){small=n;}
};
void main()
{
CRoot A;
CDer1 B(3);
CDer2 C;
A.showsmall();
B.showsmall();
C.showsmall();
}