#include <iostream> using namespace std; enum class Enum:int { val1, val2, val3}; int main(int argc, char** argv){ if(argc < 2){ cout << "Not enough paramters!" << endl; return 1; } cout << "The enum is: " << static_cast<Enum>(*(argv+1)) << endl; return 0;}
dd
prog.cpp: In function ‘int main(int, char**)’: prog.cpp:17:59: error: invalid static_cast from type ‘char*’ to type ‘Enum’ cout << "The enum is: " << static_cast<Enum>(*(argv+1)) << endl; ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!