#include <iostream>
using namespace std;
class Skill
{
int *nSkill;
public:
Skill(int n) {
nSkill = new int;
*nSkill = n;
cout << "member object " << (*nSkill) <<" constructed" << endl;
}
~Skill(){
cout << "member object " << (*nSkill) <<" destructed" << endl;
delete nSkill;
}
};
class Bug
{
private :
int nLegs;
int nColor;
public:
int nType;
Bug (int legs, int color){
nLegs = legs;
nColor = color;
cout << "Bug object constructed" << endl;
}
~Bug (){
cout << "Bug object destructed" << endl;
}
void PrintBug () { };
};
class FlyBug : public Bug
{
private:
int nWings;
Skill nLegs;
Skill nColor;
public:
FlyBug() :Bug(2, 1), nWings(0), nLegs(2), nColor(1){ cout << "FlyBug object constructed" << endl; }
~FlyBug(){ cout << "FlyBug object destructed" << endl; }
};
int main()
{
do{
FlyBug fb;
fb.PrintBug();
} while (0);
return 0;
}