Why no acess to other structs in classes?

BCS nada at pathlink.com
Sun Nov 5 14:37:09 PST 2006


Accessing the outer class would require a pointer to it. The only way to get that
pointer would be to add a hidden value to the struct. In D, structs are bare bones
aggregates without any hidden stuff added in.

== Quote from Karen Lanrap (karen at digitaldaemon.com)'s article
> class C
> {
>     struct S
>     {
>         uint data;
>     }
>     S s;
>     struct T
>     {
>         uint f()
>         {
>             return s.data;
>             // this for s needs to be type C not type T *
>         }
>     }
> }
> void main(){}




More information about the Digitalmars-d-learn mailing list