Skip to content
Jean-Michel DECORET edited this page Jan 19, 2016 · 2 revisions

Enum names begin by the 'E' upper-case letter, follow by an upper-case letter for first the name letter. Enum keys begin by the 'k' lower-case letter, follow by an upper-case letter for first the key letter.

enum EComponentState
{
   kUnknown,
   kRunning,
   kStopRequested,
   kStopped
};

As much as possible, enums have to be declared inside classes

class CSerialFactory
{
public:
   enum ESerialType
   {
      kRs232,
      kRs422_485
   };

   ...
}

Enum usage will be like :

CSerialFactory::ESerialType type;
type = CSerialFactory::kRs232;
Clone this wiki locally