Using static_cast: for enum data type : static_cast « Development « C++ Tutorial






#include <iostream>
#include <ostream>

enum color   { red, black };

int main()
{
  color c = static_cast<color>(red);
}








5.20.static_cast
5.20.1.Use static_cast.
5.20.2.Using static_cast: base and derived class
5.20.3.Using static_cast: for enum data type