// Class_Struct.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
struct Base
{
virtual func1()=0;
virtual func2()=0;
virtual func3()=0;
};
class Derived:public Base
{
virtual func1(){printf("Derived::func1()!\n");}
virtual func2(){printf("Derived::func2()!\n");}
virtual func3(){printf("Derived::func3()!\n");}
};
int main(int argc, char* argv[])
{
Base *pObj=new Derived();
pObj->func1();
pObj->func2();
pObj->func3();
printf("Hello World!\n");
return 0;
}
/************************************************************************/
/* Derived::func1()!
Derived::func2()!
Derived::func3()!
Hello World!
Press any key to continue */
/************************************************************************/
struct Base class Derived:public Base
最新推荐文章于 2022-05-02 21:25:39 发布