I have an object and one of its properties is object.type when I return object.type it returns 2 but I would rather it return the enumeration of 2 for example soft
enum type {
hard = 0,
brittle,
soft
};
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.
The usual easiest (and correct) way of doing it may be using a
std::mapfor that:(if
typeis of typeMyEnum). There are other alternatives, more or less portable, but you’re safe with this.