Hi all!
I want to use type safe enumeration like in C++11
enum class Fruit
{
apple,
orange,
pear
}
enum class Fruit
{
apple,
orange,
pear
}
To copy to clipboard, switch view to plain text mode
and use it in more (then one) classes
class FruitCake
{
Fruit baseFruit; //use: baseFruit = Fruit::apple;
}
class Person
{
Fruit favoriteFruit; //use: favoriteFruit = Fruit::apple;
}
if(john.favoriteFruit == myCake.baseFruit)
john.eat(myCake)
class FruitCake
{
Fruit baseFruit; //use: baseFruit = Fruit::apple;
}
class Person
{
Fruit favoriteFruit; //use: favoriteFruit = Fruit::apple;
}
if(john.favoriteFruit == myCake.baseFruit)
john.eat(myCake)
To copy to clipboard, switch view to plain text mode
OK, this can be done easily. But I want all the goodies that Q_ENUMS provides (The meta data of enum).
How can i do that?
Sorry for non-imaginative example
Bookmarks