I Have an enum which contains 3 different values
enum
{
inputValidation_Zipcode,
inputValidation_String,
inputValidation_Number
} InputValidation;
I am trying to pass one of these three enum values to a method, and have tried the following.
bool methodName(enum InputValidation inputenum)
bool methodName(InputValidation inputenum)
and ofc
bool methodName(int inpoutenum)
(All three called as methodName(InputValidation_Number) )
I know the last one will "work" but allows ALL integers as arguments. How can I Write a method to only accept the inputValidation values?
Your enum definition is wrong, it should be:
enum /*class*/ InputValidation
{
inputValidation_Zipcode,
inputValidation_String,
inputValidation_Number
};
Then you might use:
bool methodName(InputValidation inputenum);