jeudi 9 avril 2020

how to correctly use typedef enum with colon int?

IN C++11, I can use the following code:

enum APPLE: int{
    A,
    B
}

and the following:

typedef enum APPLE{
    A,
    B
}APP;

BUT, How to combine two of them? I try this but get error:

typedef enum APPLE: int{
    A,
    B
}APP;

The compile environment is GCC 4.8.5 Linux

error: expected identifier or ‘(’ before ‘:’ token
 typedef enum APPLE:int{
                   ^
warning: data definition has no type or storage class [enabled by default]
 }APP;
  ^

Aucun commentaire:

Enregistrer un commentaire