Cpp Enum
We can define enum like follows:
enum NetworkType {
TCP = 255;
UDP = 245;
}
And then to use it we can just do
NetworkType getNetworkType(int indicator = 0) {
if (indicator == 0) {
return NetworkType::TCP;
}
return NetworkType::UDP;
}
if (getNetworkType(1) == NetworkType::UDP) {
cout << "Yes" << endl;
}