Enum “Inheritance”

I have an enum in a low level namespace. I’d like to provide a class or enum in a mid level namespace that “inherits” the low level enum.

namespace low
{
   public enum base
   {
      x, y, z
   }
}

namespace mid
{
   public enum consume : low.base
   {
   }
}

I’m hoping that this is possible, or perhaps some kind of class that can take the place of the enum consume which will provide a layer of abstraction for the enum, but still let an instance of that class access the enum.

Thoughts?

EDIT:
One of the reasons I haven’t just switched this to consts in classes is that the low level enum is needed by a service that I must consume. I have been given the WSDLs and the XSDs, which define the structure as an enum. The service cannot be changed.

15 Answers
15

Leave a Comment