I have following situation, there are two interfaces:
interface ILLShapeAttribute
{
virtual void DefineAttribute(const char* pszAttributeName, VARIANT* pvAttributeData) = 0;
};
interface ILLShapeNotification
{
virtual bool IsUsed(const RECT& rcBounds) = 0;
virtual void DefineAttribute(const char* pszAttributeName, VARIANT* pvAttributeData) = 0;
}
And 2 functions:
INT LlShapeGetAttributeList(LPCWSTR pwszShapefileName, ILLShapeAttribute* pIAttrInfo);
INT LlShapeEnumShapes(LPCWSTR pwszShapefileName, ILLShapeNotification* pIInfo);
In those both functions I want to call the same function IterateRecords2
which should get the pointer to the function DefineAttribute, e.g. ILLShapeAttribute::DefineAttribute
and ILLShapeNotification::DefineAttribute
I defined it this way:
void IterateRecords2(ifstream& file, void (*pDefineAttribute)(const char*, VARIANT*))
{
pDefineAttribute(NULL, NULL); //will be called with real values
}
Until now the code compiles and everythig is fine. But then I try to call the IterateRecords2
like
IterateRecords2(file, pIAttrInfo->DefineAttribute);
or
IterateRecords2(file, pIInfo->DefineAttribute);
I get the compiler error:
error C3867: 'ILLShapeAttribute::DefineAttribute': function call missing argument list; use '&ILLShapeAttribute::DefineAttribute' to create a pointer to member
Please: I know, that ILLShapeNotification could inherit from ILLShapeAttribute and then pass *ILLShapeAttribute instead of function pointer but I want to understand how it works.
Question: how can I pass the pointer to DefineAttribute
to IterateRecords2
?