您的位置:首页 > 其它

不知道是不是VS.NET 2003的bug

2007-04-09 19:48 381 查看
#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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息