I make a program in of inheritance in which I declared an ENUM Type enum BREED {GOLDEN, CAIRN, DANDIE, SHETLAND, DOBERMAN, LAB}; I am inheriting some functions from the base class for my Dog Class, so when I made the the object of the class and wanted to access the BREED function Dog Fido;
Fido.SetBreed(CAIRN);
cout<<"Fido,s Breed is " << Fido.GetBreed()<< endl;
so it shows me the output that "Fido,s Breed is 1" which is although right because in ENUM it counts the values from 0 and so on, so CAIRN is on position 1 so its quite right.
Now my Question is that how to print the names in the Enum type on the screen. I mean it doesn,t show me numbers like 0,1,2,3 it directly shows me GOLDEN, CAIRN or whatever value i pass to its function accordingly.
You'll have to manually make a conversion method using a map or just a switch/case or something similar. There is no built-in way to retrieve the names of the enumeration's values.