惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - ifdef

wxRichTextCtrl移动到最后一行显示 MFC的DLL工程加载异常的问题 VC FormView 上的CEdit不能响应复制粘贴按键(CTRL+C和CTRL+V)的问题 win10环境安装vs2015的问题:缺少JavaScript_ProjectSystem.msi和JavaScript_LanguageService.msi等等 记录:LINUX下,编译一个调用了OPENCV库的程序出错的解决方法 解决:小米11导入其他手机的VCF文件后,电话簿不完整的问题 调用libhv的HTTP客户端给服务器发送图片失败或图片不完整的问题 linux下查看usb设备的端点、VID/PID等信息 VS2010编译静态链接MFC的OCX遇到的问题:nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 已经在 LIBCMTD.lib(dllmain.obj) 中定义 linux C++中宏定义的问题:error: unable to find string literal operator ‘operator""fmt’ with ‘const char [4]’, ‘long unsigned int’ arguments 新装vs2010的问题:fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 windows下删除虚拟串口的方法,以及解决串口使用中,无法变更设备串口号的问题 error C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _stricmp. 给linux shell 添加ll命令支持 编译WDF驱动项目时,缺少WDKConversion\PreConfiguration.props文件的问题 - ifdef - 博客园 VS2010的_vscprintf函数在BCB6下的替代方法vsnprintf LINUX下USB转串口编程中的一点心得 逐个删除网页输入框的下拉提示 升级win10 1903版后,vmware打开虚拟机黑屏的解决办法
error C3867: “ClassA::OnFuncA”: 函数调用缺少参数列表;请使用“&ClassA::OnFuncA”创建指向成员的指针
ifdef · 2020-07-17 · via 博客园 - ifdef

编译一段古老的VC6代码,发现一个类成员函数用作其他成员函数内部调用的参数的情况,会报错error C3867

原始代码如下

class TempalteBase
{
public:
  virtual HRESULT Call( int A, int B ) = 0;

  TempalteBase( UINT Id ) : m_TestID(Id) {
    //
  }
  UINT TestId() { return m_TestID; }

protected:
  UINT m_TestID;
};


template <class BASECLASS> class TemplateA : public TempalteBase {
public:
  typedef HRESULT (BASECLASS::*PFNMEMBERFUNCTION)( int A, int B );

  TemplateA( UINT Id, BASECLASS* pObject, PFNMEMBERFUNCTION pFunction  )
      : TempalteBase( Id ), m_pObject(pObject), m_pFunction(pFunction) {
    //
  }
  HRESULT Call( int A, int B ) {
    return (m_pObject->*m_pFunction)(A, B);
  }

protected:
  BASECLASS* m_pObject;
  PFNMEMBERFUNCTION m_pFunction;
};


class ClassA {
private:
public:
  ClassA() {
    TempalteBase* p = new TemplateA<ClassA>(123, this, OnFuncA);
    p->Call(11, 22);
  }
  ~ClassA();
public:
  HRESULT OnFuncA( int A, int B) {
    int a = A;
    int b = B;
    return 0;
  }
};

其中编译出错的一段代码是 

TempalteBase* p = new TemplateA<ClassA>(123, this, OnFuncA);

应该修改为

TempalteBase* p = new TemplateA<ClassA>(123, this, &ClassA::OnFuncA);