--- title: "case (C++) | Microsoft Docs" ms.custom: "" ms.date: "11/04/2016" ms.reviewer: "" ms.suite: "" ms.technology: - "cpp-windows" ms.tgt_pltfrm: "" ms.topic: "language-reference" f1_keywords: - "vc-attr.case" dev_langs: - "C++" helpviewer_keywords: - "case attribute" ms.assetid: 6fb883c3-0526-4932-a901-b4564dcaeb7d caps.latest.revision: 10 author: "mikeblome" ms.author: "mblome" manager: "ghogen" translation.priority.ht: - "cs-cz" - "de-de" - "es-es" - "fr-fr" - "it-it" - "ja-jp" - "ko-kr" - "pl-pl" - "pt-br" - "ru-ru" - "tr-tr" - "zh-cn" - "zh-tw" --- # case (C++) Used with the [switch_type](../windows/switch-type.md) attribute in a **union**. ## Syntax ``` [ case( value ) ] ``` #### Parameters *value* A possible input value for which you want to provide processing. The type of **value** can be one of the following types: - `int` - `char` - `boolean` - `enum` or an identifier of such a type. ## Remarks The **case** C++ attribute has the same functionality as the **case** MIDL attribute. This attribute is only used with the [switch_type](../windows/switch-type.md) attribute. ## Example The following code shows a use of the **case** attribute: ``` // cpp_attr_ref_case.cpp // compile with: /LD #include [export] struct SizedValue2 { [switch_type(char), switch_is(kind)] union { [case(1), string] wchar_t* wval; [default, string] char* val; }; char kind; }; [module(name="ATLFIRELib")]; ``` ## Requirements ### Attribute Context ||| |-|-| |**Applies to**|Member of a **class** or `struct`| |**Repeatable**|No| |**Required attributes**|None| |**Invalid attributes**|None| For more information about the attribute contexts, see [Attribute Contexts](../windows/attribute-contexts.md). ## See Also [IDL Attributes](../windows/idl-attributes.md) [Typedef, Enum, Union, and Struct Attributes](../windows/typedef-enum-union-and-struct-attributes.md) [Class Attributes](../windows/class-attributes.md)