optional (C++)

Gibt einen optionalen Parameter für eine Memberfunktion an.

Syntax

[optional]

Hinweise

Das optionale C++-Attribut weist die gleiche Funktionalität wie das optionale MIDL-Attribut auf.

Beispiel

Der folgende Code zeigt, wie optional verwendet werden kann:

// cpp_attr_ref_optional.cpp
// compile with: /LD
#include "unknwn.h"
[module(name="ATLFIRELib")];

[dispinterface, uuid("00000000-0000-0000-0000-000000000001")]
__interface IFireTabCtrl : IDispatch
{
   [id(1)] long procedure ([in, optional] VARIANT i);
};

Anforderungen

Attributkontext Wert
Gilt für Schnittstellenparameter
Wiederholbar Nein
Erforderliche Attribute None
Ungültige Attribute None

Weitere Informationen zu den Attributkontexten finden Sie unter Attributkontexte.

Siehe auch

IDL-Attribute
Parameterattribute