#include <windows.h>
__interface INew
//Microsoft Visual Studio .NET 2003开发文档中规定 interface Can only contain public, pure virtual methods.
{
void MsgHelloWorld();
//不知道什么原因,这理却可以写函数的实现代码。
{
MessageBox(NULL,"Hello World","Notice",MB_OK);
};
//如果这理没有实现代码,必须将以上声明改为如下的样子才能编译。
//virtual void MsgHelloWorld()=0;
//且在重载该接口时,再不能调用INew::MsgHelloWorld();
};
class NewClass:public INew
{
public:
void MsgHelloWorld()
{
INew::MsgHelloWorld();
}
};
int main()
{
INew * nc = new NewClass() ;
nc->MsgHelloWorld();
delete nc ;
return 0;
}