Compartir a través de


Visual C++ Enumerations in Class Designer

Class Designer supports C++ enum and scoped enum class types. Following is an example:

enum CardSuit {
   Diamonds = 1,
   Hearts = 2,
   Clubs = 3,
   Spades = 4
};

// or...
enum class CardSuit {
   Diamonds = 1,
   Hearts = 2,
   Clubs = 3,
   Spades = 4
};

A C++ enumeration shape in a class diagram looks and works like a structure shape, except that the label reads Enum or Enum class, it is pink instead of blue, and it has a colored border on the left and top margins. Both enumeration shapes and structure shapes have square corners.

For more information about using the enum type, see C++ Enumeration Declarations.

Code element

Description

enum EnumName
   {
      enumeration list
   } [declarator];

EnumName

Enum

(The enumeration list is comma-delimited, and the declarator is optional.)

See Also

Reference

C++ Enumeration Declarations

Concepts

Working with Visual C++ Code (Class Designer)