#define?BASE00_H
class?base00
{
public:
base00();
virtual?~base00();
virtual?void?GetPortCount(void)?=?0;
protected:
private:
};
class?base01?:?public?base00
{
public:
base01();
virtual?~base01();
virtual?void?GetPortCount(void);
protected:
private:
};
class?base02?:?public?base01
{
public:
base02();
virtual?~base02();
virtual?void?GetPortCount(void);
protected:
private:
};
#endif?//?BASE00_H
#include?<iostream>
#include?"base00.h"
using?namespace?std;
base00::base00()
{
//ctor
std::cout?<<?__func__?<<?std::endl;
}
base00::~base00()
{
//dtor
std::cout?<<?__func__?<<?std::endl;
}
base01::base01()
{
//ctor
std::cout?<<?__func__?<<?std::endl;
}
base01::~base01()
{
//dtor
std::cout?<<?__func__?<<?std::endl;
}
base02::base02()
{
//ctor
std::cout?<<?__func__?<<?std::endl;
}
base02::~base02()
{
//dtor
std::cout?<<?__func__?<<?std::endl;
}
void?base01::GetPortCount()
{
std::cout?<<?"base01::GetPortCount"?<<?std::endl;
}
void?base02::GetPortCount()
{
std::cout?<<?"base02::GetPortCount"?<<?std::endl;
}
int?main(int?argc,?char?**argv)
{
cout?<<?"Hello?world!"?<<?endl;
base00?*b1?=?new?base01;
base00?*b2?=?new?base02;
b1->GetPortCount();
b2->GetPortCount();
delete?b1;
delete?b2;
return?0;
}