I have an abstract base class with an enum which is passed into a
method. I want my derived classes to be able to add new values to the
enum without having to redefine it and I want to be able to pass them
into the method defined into the base class. Is there a way to do
this.
E.g.
abstract public class BaseWidget
{
public void Clear(Wodget wodget)
{
//do stuff with wodget
}
//other methods, etc.
public enum Wodget
{
wodget1, wodget2
}
}
public class LargeWidget: BaseWidget
{
//other methods, etc.
public enum Wodget
{
wodget3, wodget4
}
}
public class SmalllWidget: BaseWidget
{
//other methods, etc.
public enum Wodget
{
wodget5, wodget6
}
}
but I want the Wodget available to LargeWidget to contain wodgets 1, 2,
3 and 4 and the Wodget available to SmallWidget to contain wodgets 1,
2, 5 and 6.
I'd like this to be automatic so taht wodgets added to the base class
automatically appear in the derived class enums (otherwise I know that
someone's going to miss adding a new one to the derived class at some
point in the future.