I have two enums:
enum class YellowFruits
{
Banana,
Lemon
};
enum class RedFruits
{
Apple,
Peach
};
I want to combine these two into one enum:
enum class Fruits
{
//YellowFruits and RedFruits
};
So that it works like this:
enum class Fruits
{
Banana,
Lemon,
Apple,
Peach
};
But I can't find a way to do it. When looking for a solution, I found this answer: Combine enums c++. But the solutions in the answers there don't work for me. I want the new enum to work just as if I had created it with the values that it should take from other enums. Is there a way to do this?