屬性 'attribute' 除了在 coclass 中以外,不需要任何引數
備註
部分屬性可以套用至多個 C++ 建構,但該屬性的部分引數只能用在部分建構上。
Example
下列範例會產生 C3373:
// C3373.cpp
#include <windows.h>
[module(name="MyModule")];
[ object, uuid(373a1a4c-469b-11d3-a6b0-00c04f79ae8f) ]
__interface IMyIface
{
// arguments to source and restricted are not allowed when
// these attributes are applied to an interface
[source(IMyIface)] HRESULT f1();
[restricted(IMyIface)] HRESULT f2(); // C3373
};
[ coclass, uuid(373a1a4d-469b-11d3-a6b0-00c04f79ae8f) ]
class CMyClass : public IMyIface {
};
int main() {
}