struct aliases

0ffh frank at frankhirsch.youknow.what.todo.net
Wed Nov 14 14:06:23 PST 2007


Jarrett Billingsley wrote:
> You could also try making Data an anonymous struct:
> 
> class C
> {
>     struct
>     {
>         int x, y
>     }
> }
> 
> And now those will be accessible through C references, but now you no longer 
> have the Data type and can no longer access both those members as a single 
> item.. 

No sweat!

class C
{
   union
   {
     struct data
     {
       int x, y;
     }
     struct
     {
       int x, y;
     }
   }
}

Unions to the rescue! =)

Regards, Frank


More information about the Digitalmars-d-learn mailing list