jeudi 1 mars 2018

enum class: syntax details: types and generalities

What does the following C++11 code mean?

    enum class myclass_t : int 
    {
       one_element= 1; second_element = 2;
    };

First: why is there the int? It obviously refers to the type of 1 and 2 but do we need it and if so why? Second: what is the difference between a normal class an enum class and a normal enum. I have looked it up but don't really get it Thanks.

Aucun commentaire:

Enregistrer un commentaire