[英]Using void object as a generic object type in C++
I have a dll that honours an interface I was given. 我有一个dll来兑现我给的接口。 In this there are a number of methods that rely on an object type defined in a header I do not have.
在这种方法中,有许多方法依赖于我没有的标头中定义的对象类型。 For example
例如
STDMETHOD(OnPrepareNextScan)(BOOL* isSurvey, long curExp, ExtractMethod* pEM,
unsigned long scanTime, double* selectedMass, double* selectedIntensity) = 0;
The header defines the ExtrctMethod type However, I dot care about this object, I am not going to use it, so I as wondering if I could use a void pointer instead. 标头定义了ExtrctMethod类型。但是,我有点关心这个对象,我将不使用它,所以我想知道是否可以使用空指针代替。
Just use a forward declaration to enable the undefined type, and pass a NULL to the function. 只需使用前向声明来启用未定义的类型,然后将NULL传递给函数。
class ExtractMethod;
OnPrepareNextScan(isSurvey, curExp, NULL, scanTime, selectedMass, selectedIntensity);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.