Enumerations and functions naming problem

I have made 7 functions and wanted to use an enumeration in a switch.
The problem is that, i want the enumeration variables to be with the same name as the functions. Both are global, so how am I supposed to trick the computer and change the naming scheme? I used for example a start(); function and if i use enum{start} this won't work. If i use for example enum{start1} this works, but looks awful. Any help?
You can use a scoped enum. For example

enum class Functions { start, other_start, last_start };

EDIT: Or if your compiler does not support scoped enumerations you can place your enum in some namespace and use the nested name specifier everywhere in the code.
Last edited on
ok I added an e_ to all of the enum variables. It worked fine
Is that the 'scoped' stuff?
Last edited on
No it is not a scoped stuff. It is a name convention. I showed above how the scoped enumeration is defined.

you mean to add it to the end?
for example start_e, end_e????
I mean either to use a scoped enumeration or use an unscoped enumeration placed in some namespace.
Topic archived. No new replies allowed.