Subtyping of an enum

Alex sascha.orlov at gmail.com
Mon Apr 15 13:48:12 UTC 2019


On Monday, 15 April 2019 at 13:38:33 UTC, Anton Fediushin wrote:
>
> This does work unless I want to use it like this:
> ```
> fun(Enum.foo);
> ---
> Error: function fun(Enum e) is not callable using argument 
> types (internal)
> cannot pass argument foo of type internal to parameter Enum e
> ```

This is correct. And you enforced this behavior as you said

> Enum.internal is private to make it inaccessible from any other 
> place. All I want is a way to have > an enum that I could 
> extend with my own methods.

So... either you pass the internals of Enum somewhere, or you 
don't...


More information about the Digitalmars-d-learn mailing list