I have an enum which is used by multiple classes. What is the best way to implement this?
Share
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.
I’d keep them in their own file for easy access and good organization either way.
I usually wouldn’t put them in a class unless they somehow ‘belong’ there. Like you have a Car class with an enum for the types of car, and a Road class and Bridge class that can set limits for types of car.
Car.CarTypeseems to be a logical organization for this…