当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 下面一段代码,测试不能通过。报错 错误类型: adodb.recordset (0x800a0bb9) 参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。 请问是程序本身有错还是其他的设置有错? <% set adoconn = server.createobject ("adodb.connection") adoconn.open = "d......
 ·ftp 功能     »显示摘要«
    摘要: 為甚麼我的 php 無法執行 ftp 的函數, 需要在 php.ini 中設定甚麼參數 ? ......


钱能 C++程序设计教程 关于虚函数的例子 在VC++6.0下无法通过

//********************************  
  //**                   ch16_5.cpp                   **  
  //********************************  
   
  #include    
   
  class   Base  
  {  
  public:  
  virtual   Base*   afn()  
  {  
  cout<<"This   is   Base   Class.   \n";  
  return   this;  
  }  
  };  
   
  class   SubClass:public   Base  
  {  
  public:  
  SubClass*   afn()   //实为虚函数  
  {  
  cout<<"This   is   SubClass.   \n";  
  return   this;  
  }  
  };  
   
  void   test(Base&   x)  
  {  
  Base*   b;  
  b   =   x.afn();  
  }  
   
  void   main()  
  {  
  Base   bc;  
  SubClass   sc;  
  test(bc);  
  test(sc);  
  }  
  //*****************************************************************************  
  --------------------Configuration:   ch16_5   -   Win32   Debug--------------------  
  Compiling...  
  ch16_5.cpp  
  D:\EXERCISES\CH16_5\ch16_5.cpp(21)   :   error   C2555:   SubClass::afn   :   overriding   virtual   function   differs   from   Base::afn   only   by   return   type   or   calling   convention  
  D:\EXERCISES\CH16_5\ch16_5.cpp(8)   :   see   declaration   of   Base  
  //*****************************************************************************  
  //恳请知其所以然者不吝赐教,大恩不言谢:)  
   
   
 

NO.1   作者: meteor135

SubClass*   afn()   //实为虚函数  
  {  
  cout<<"This   is   SubClass.   \n";  
  return   this;  
  }  
  ====>  
  Base*   afn()   //实为虚函数  
  {  
  cout<<"This   is   SubClass.   \n";  
  return   (Base*)this;  
  }  
 

NO.2   作者: meteor135

//********************************  
  //**                   ch16_5.cpp                   **  
  //********************************  
   
  #include   <iostream.h>  
   
  class   Base  
  {  
  public:  
  virtual   Base*   afn()  
  {  
  cout<<"This   is   Base   Class.   \n";  
  return   this;  
  }  
  };  
   
  class   SubClass:public   Base  
  {  
  public:  
  Base*   afn()   //实为虚函数  
  {  
  cout<<"This   is   SubClass.   \n";  
  return   (Base*)this;  
  }  
  };  
   
  void   test(Base&   x)  
  {  
  Base*   b;  
  b   =   x.afn();  
  }  
   
  void   main()  
  {  
  Base   bc;  
  SubClass   sc;  
  test(bc);  
  test(sc);  
  }  
   
  --------------------Configuration:   TestVirtual   -   Win32   Debug--------------------  
  Compiling...  
  TestVirtual.cpp  
  Linking...  
   
  TestVirtual.exe   -   0   error(s),   0   warning(s)  
   
  --------------------------------------------------------------------------------  
  This   is   Base   Class.  
  This   is   SubClass.  
  Press   any   key   to   continue

NO.3   作者: ib586

用Dev-C++能通过,这个很正常,VC不支持这个标准。

NO.4   作者: Kidsheep

VC6.0不支持根据函数的返回值来区分重载函数,用VC7.0可以通过。


    摘要: 各位高手,怎样在outlook里处理垃圾邮件啊?!!! 我在ms outlook里这样操作,<动作> --> <垃圾邮件> --> <添加到“垃圾发件人”列表中> 按理我添加它的地址到“垃圾发件人”列表中,那下次就不应该再能看到这个垃圾邮件了,但实际上我还总是要每天都收到同一地址来的垃圾邮件。 各位,救命啊!到底怎么样才能在杜绝掉某个地址发来......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE