How to do "inheritance" in D structs

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 11 23:25:27 PDT 2016


On 2016-10-12 04:33, lobo wrote:

> This approach works nicely although it feels clumsy but that's probably
> just because I'm so used to C++. It also handles private members as I'd
> expect, i.e. they're not accessible outside module scope through the
> alias struct instance, but there is no protected. Protected appears to
> behave the same way as private.
>
> I think I can live with that because I usually try to avoid protected
> anyway.

I only expect "protected" to work with real inheritance, i.e. classes. 
Note that there's "package" protection attribute as well.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list