F
frank_skare
Hello everybody,
I'm writing a COM component and don't want to put the IUnknown
implementation in every COM class so I'm using inheritance. I'm
getting a error 'cannot instantiate abstract class' even though all
virtual methods are implemented. Can anybody tell me what I'm doing
wrong?
thanks
Frank
#include "stdafx.h"
#include <shlobj.h>
class ComBase
{
public:
STDMETHOD(QueryInterface)(REFIID,LPVOID*);
STDMETHODIMP_(ULONG) AddRef()
{
return 0;
}
STDMETHODIMP_(ULONG) Release()
{
return 0;
}
};
class ComClass: public ComBase, public IShellExtInit
{
public:
STDMETHOD(QueryInterface)(REFIID,LPVOID*);
STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
};
STDMETHODIMP ComClass::QueryInterface(REFIID riid, LPVOID *ppv)
{
return E_NOTIMPL;
}
STDMETHODIMP ComClass::Initialize(
LPCITEMIDLIST pidlFolder,
LPDATAOBJECT pDataObj,
HKEY hProgID
)
{
return E_NOTIMPL;
}
int _tmain(int argc, _TCHAR* argv[])
{
ComClass argh;
return 0;
}
I'm writing a COM component and don't want to put the IUnknown
implementation in every COM class so I'm using inheritance. I'm
getting a error 'cannot instantiate abstract class' even though all
virtual methods are implemented. Can anybody tell me what I'm doing
wrong?
thanks
Frank
#include "stdafx.h"
#include <shlobj.h>
class ComBase
{
public:
STDMETHOD(QueryInterface)(REFIID,LPVOID*);
STDMETHODIMP_(ULONG) AddRef()
{
return 0;
}
STDMETHODIMP_(ULONG) Release()
{
return 0;
}
};
class ComClass: public ComBase, public IShellExtInit
{
public:
STDMETHOD(QueryInterface)(REFIID,LPVOID*);
STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
};
STDMETHODIMP ComClass::QueryInterface(REFIID riid, LPVOID *ppv)
{
return E_NOTIMPL;
}
STDMETHODIMP ComClass::Initialize(
LPCITEMIDLIST pidlFolder,
LPDATAOBJECT pDataObj,
HKEY hProgID
)
{
return E_NOTIMPL;
}
int _tmain(int argc, _TCHAR* argv[])
{
ComClass argh;
return 0;
}