Switch Statements with strongly typed enumerations [duplicate]

An enumeration type is still an enumeration type even whether strongly typed or not, and have always worked fine in switch statements.

See this program for example:

#include <iostream>

enum class E
{
    A,
    B
};

int main()
{
    E e = E::A;

    switch (e)
    {
    case E::A:
        std::cout << "A\n";
        break;
    case E::B:
        std::cout << "B\n";
        break;
    }
}

The output of this is “A”.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)