c++ 枚举 在函数中的应用
#include <iostream> using namespace std; enum RespErrNo { SUCCESS = 0, INVALID_URL = 1, INVALID_SRC_ID = 2 }; RespErrNo fun(){ return INVALID_URL; } int main() { int a = fun();
RespErrNo b = fun(); cout << a << endl; return 0; }
#include <iostream> using namespace std; enum RespErrNo { SUCCESS = 0, INVALID_URL = 1, INVALID_SRC_ID = 2 }; RespErrNo fun(){ return INVALID_URL; } int main() { int a = fun();
RespErrNo b = fun(); cout << a << endl; return 0; }