close
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class Cls1
{
public:
Cls1();
virtual void word();
};
Cls1::Cls1()
{}
void Cls1::word()
{
cout<<"this function is in Cls1!\n";
}
class Cls2:public Cls1
{
public:
Cls2();
void word();
};
Cls2::Cls2()
{}
void Cls2::word()
{
cout<<"this function is in Cls2!\n";
}
int main()
{
Cls2 test;
Cls1 *a;
a=&test;
a->word();
return 0;
}
全站熱搜