기본 (C++)

사용자 지정 또는 dispinterface coclass 내에서 정의 된 기본 프로그래밍 인터페이스를 나타냅니다.

[ default(
   interface1,
   interface2
) ]

매개 변수

  • interface1
    개체를 만들 수 있는 스크립팅 환경에 사용할 수 있게 하는 기본 인터페이스를 기반으로 클래스를 정의 하는 기본 특성입니다.

    없음 기본 인터페이스를 지정 하면 맨 처음 발견 되는 nonsource 인터페이스를 기본값으로 사용 됩니다.

  • interface2(옵션)
    기본 소스 인터페이스입니다.이 인터페이스와 함께 지정 해야 해당 소스 특성입니다.

    없음 기본 소스 인터페이스를 지정 하면 첫 번째 소스 인터페이스를 기본값으로 사용 됩니다.

설명

기본 C++ 특성을 동일한 기능을가지고 있는 기본 MIDL 속성입니다.기본 특성으로 사용 되도 경우 특성.

예제

다음 코드는 기본 의 coclass 정의를 지정할 수 있습니다 ICustomDispatch 의 기본 프로그래밍 인터페이스.

// cpp_attr_ref_default.cpp
// compile with: /LD
#include "windows.h"
[module(name="MyLibrary")];

[object, uuid("9E66A290-4365-11D2-A997-00C04FA37DDB")]
__interface ICustom {
   HRESULT Custom([in] long l, [out, retval] long *pLong);
};

[dual, uuid("9E66A291-4365-11D2-A997-00C04FA37DDB")] 
__interface IDual {
   HRESULT Dual([in] long l, [out, retval] long *pLong);
};

[object, uuid("9E66A293-4365-11D2-A997-00C04FA37DDB")]
__interface ICustomDispatch : public IDispatch {
   HRESULT Dispatch([in] long l, [out, retval] long *pLong);
};

[   coclass,
   default(ICustomDispatch), 
   source(IDual),
   uuid("9E66A294-4365-11D2-A997-00C04FA37DDB")
]
class CClass : public ICustom, public IDual, public ICustomDispatch {
   HRESULT Custom(long l, long *pLong) { return(S_OK); }
   HRESULT Dual(long l, long *pLong) { return(S_OK); }
   HRESULT Dispatch(long l, long *pLong) { return(S_OK); }
};

int main() {
#if 0 // Can't instantiate without implementations of IUnknown/IDispatch
   CClass *pClass = new CClass;

   long llong;

   pClass->custom(1, &llong);
   pClass->dual(1, &llong);
   pClass->dispinterface(1, &llong);
   pClass->dispatch(1, &llong);

   delete pClass;
#endif
   return(0);
}

해당 원본 특성을 사용 하는 방법의 예도 있습니다. 기본.

요구 사항

컨텍스트 특성

적용 대상

클래스, struct, 데이터 멤버

반복 가능

아니요

필수 특성

coclass (적용 될 때 클래스 또는 struct)

잘못 된 특성

없음

자세한 내용은 컨텍스트 특성.

참고 항목

참조

coclass

기타 리소스

IDL 특성

클래스 특성

Attributes Samples