anonymous structs within structs
DLearner
bmqazwsx123 at gmail.com
Mon Dec 4 22:16:30 UTC 2023
On Monday, 4 December 2023 at 21:55:29 UTC, Mike Shah wrote:
[...]
>
> Is something like this what you had in mind?
>
> ```
> void main() {
> import std.stdio;
>
> mixin template A() {
> int I1;
> int I2;
> char X;
> }
>
> struct B {
> mixin A;
> int Var1;
> int Var2;
> }
>
> B someObject;
> writeln(someObject.I1);
> writeln(someObject.I2);
> }
> ```
More like
```
B someObject;
writeln(someObject.Var1);
writeln(someObject.Var2);
```
In the areas where B is used, don't want I1 or I2 to be visible.
More information about the Digitalmars-d-learn
mailing list