C++ 如何基于数组参数项类型在IDL中重载函数?

C++ 如何基于数组参数项类型在IDL中重载函数?,c++,com,atl,idl,safearray,C++,Com,Atl,Idl,Safearray,假设我在IDL中定义了如下函数: [propget, id(6), helpstring("property MyArray")] HRESULT MyArray([out, retval] SAFEARRAY(myEnum)* pVal); [propget, id(7), helpstring("property MyArray")] HRESULT MyArray([out, retval] SAFEARRAY(BSTR)* pVal); STDMETHOD(get_Installed

假设我在IDL中定义了如下函数:

[propget, id(6), helpstring("property MyArray")]
HRESULT MyArray([out, retval] SAFEARRAY(myEnum)* pVal);
[propget, id(7), helpstring("property MyArray")]
HRESULT MyArray([out, retval] SAFEARRAY(BSTR)* pVal);
STDMETHOD(get_InstalledScanningDetectors)(SAFEARRAY** pVal);
我想为IDL中定义的函数创建一个重载,如下所示:

[propget, id(6), helpstring("property MyArray")]
HRESULT MyArray([out, retval] SAFEARRAY(myEnum)* pVal);
[propget, id(7), helpstring("property MyArray")]
HRESULT MyArray([out, retval] SAFEARRAY(BSTR)* pVal);
STDMETHOD(get_InstalledScanningDetectors)(SAFEARRAY** pVal);
但在实现该函数的类的头文件中,原始的声明如下:

[propget, id(6), helpstring("property MyArray")]
HRESULT MyArray([out, retval] SAFEARRAY(myEnum)* pVal);
[propget, id(7), helpstring("property MyArray")]
HRESULT MyArray([out, retval] SAFEARRAY(BSTR)* pVal);
STDMETHOD(get_InstalledScanningDetectors)(SAFEARRAY** pVal);

因此,数组中项目的类型不再是签名的一部分。因为我正试图创建一个重载函数,它正是基于函数签名的这种差异。。如何继续???

SAFEARRAY
是独特的类型(实际上是嵌入数组相关成员的结构),其有效元素类型不能是签名的一部分。您可以使用一个方法返回这个或那个数组,或者您可以使用两个名称不同的方法返回数组。

您不能这样做@罗曼有答案。重命名这些方法,使其具有不同的名称。