I have multiple related enums like this:
enum solidmaterial { MARBLE, RUBY, ICE, … };
enum organicmaterial { BANANA, BREAD, BONE, … };
enum gasmaterial { AIR, SMOKE, GHOST, … };
…
I can define a function to take a solidmaterial
, e.g. void Foo(solidmaterial M);
, and I can also define a function to take an int
and pass any one of these enums to it.
But can I somehow define a function that could take any one of these enums but not anything else? Maybe a parent enum material
that includes all these more specific enums. Is this possible?
Aucun commentaire:
Enregistrer un commentaire