我继承了一个windows mapi 接口IMAPIAdviseSink.class CMAPIAdviseSinker:public IMAPIAdviseSink
{
public:
ULONG OnNotify( ULONG cNotif, LPNOTIFICATION lpNotifications );
};ULONG CMAPIAdviseSinker::OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifications )
{
AfxMessageBox(L"Hi,I got it,but havnt handled it yet.");
return 0;
}声明了一个实例:CMAPIAdviseSinker m_sinker;
编译总说我
error C2259: 'CMAPIAdviseSinker' : cannot instantiate abstract class due to following members:
see declaration of 'CMAPIAdviseSinker'到底如何实现此接口呢?和IMAPIAdviseSink : IUnknown有关系么?
{
public:
ULONG OnNotify( ULONG cNotif, LPNOTIFICATION lpNotifications );
};ULONG CMAPIAdviseSinker::OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifications )
{
AfxMessageBox(L"Hi,I got it,but havnt handled it yet.");
return 0;
}声明了一个实例:CMAPIAdviseSinker m_sinker;
编译总说我
error C2259: 'CMAPIAdviseSinker' : cannot instantiate abstract class due to following members:
see declaration of 'CMAPIAdviseSinker'到底如何实现此接口呢?和IMAPIAdviseSink : IUnknown有关系么?
是不是应该这样啊:
IMAPIAdviseSinker m_sinker;
你写成了CMAPIAdviseSinker m_sinker;
从接口继承,你需要在实现类CMAPIAdviseSinker中重载接口中的纯虚函数,包括IUnknown中的QueryInterface,AddRef,Release.还有IMAPIAdviseSinker中的纯虚函数.