开发者

Extending ENUM valus inherited from base object

If I defined a ENUM in a base object with several default values. When I inherit from the base object I want to add more options the the ENUM list which are specific to the inheriting object.

For example my base could have a ENUM called Direction with values:

None

ALL

Stop

Start

I create a new class call Compass which inherits the base class and what to add the following to the ENUM Direction.

North

South

East

West

I create a new class call Navigation which inherits the base cl开发者_运维知识库ass and what to add the following to the ENUM Direction.

Left

Right

So, In my inheriting class haow do I extend the ENUM. I am using VB.NET.


You can't do that since enums are value types and so are sealed.

Though he's a codeproject article that tries to work around that: http://www.codeproject.com/KB/cs/EnumBuilder.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜