#include <iostream>
using namespace std;
class CBicycle
{
protected:
int m_iWeight;
public:
CBicycle()
{
cout << "Bicycle Construct" << endl;
}
CBicycle(int iWeight)
{
m_iWeight = iWeight;
}
void Run()
{
cout << "Bicycle Run" << endl;
}
};
class CAirplane
{
protected:
int m_iWeight;
public:
CAirplane()
{
cout << "Airplane Construct" << endl;
};
CAirplane(int iWeight)
{
m_iWeight = iWeight;
}
void Fly()
{
cout << "Aorplane Fly" << endl;
}
};
class CAirBicycle :public CBicycle, public CAirplane
{
public:
CAirBicycle()
{
cout << "CAirBicycle Construct" << endl;
}
void RunFly()
{
cout << "Run and Fly" << endl;
}
};
void main()
{
CAirBicycle ab;
ab.RunFly();
cin.get();
}
通过运行结果可看出多继承。