Since enums are typically handled as some size of int in the compiler, all you have to do is later make
enum PizzaDressing
{
Olives = 0,
Cheese = 1,
Pepperoni = 2
};
or you could allow it to count
enum PizzaDressing
{
Olives = 0,
Cheese = 1,
Pepperoni
};
You could, if neither of those is acceptable for some reason, use math (Cheese + 1
).
You can play around with the enum in almost any way you could with a numeric value.
Note that the enumerator you use is typically baked into the code by the compiler, it doesn't show up as its name, simply value. Thus, modifying (extending) the enumerator later on will not effect code that has been built.
I think it's legal syntax to use an enumeration in another enumerator, with casts, but I've never tried it. This may work, but is kind of ugly:
enum PizzaDressing
{
Olives = 0,
Cheese = 1
};
enum OtherPizzaDressings
{
Start = (OtherPizzaDressings)PizzaDressing::Cheese;
Pepperoni
};