Just wondering if it is possible to declare a function of an enumerated type in C++
For example:
class myclass{
//....
enum myenum{ a, b, c, d};
myenum function();
//....
};
myenum function()
{
//....
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
yes, it is very common to return an enum type.
You will want to put your enum outside of the class though since the function wants to use it. Or scope the function’s enum return type with the class name (enum must be in a public part of the class definition).