What is the best way to "override" enums?
- by Tyler
I have a number of classes which extend an abstract class. The abstract parent class defines an enum with a set of values. Some of the subclasses inherit the parent class's enum values, but some of the subclasses need the enum values to be different. Is there any way to somehow override the enum for these particular subclasses, and if not, what is a good way to achieve what I'm describing?
class ParentClass
{
private MyEnum m_EnumVal;
public virtual MyEnum EnumVal
{
get { return m_EnumVal; }
set { m_EnumVal = value; }
}
public enum MyEnum { a, b, c };
}
class ChildClass : ParentClass
{
private MyEnum m_EnumVal;
public virtual MyEnum EnumVal
{
get { return m_EnumVal; }
set { m_EnumVal = value; }
}
public enum MyEnum { d, e, f };
}