xxxxxxxxxx
import std.stdio;
mixin template S1andS2Fields()
{
int field1;
string field2;
}
struct S1
{
mixin S1andS2Fields;
}
struct S2
{
mixin S1andS2Fields;
}
struct S3
{
S2 s;
alias s this;
}
void main(string[] args)
{
S1 s1;
S2 s2;
S2 s3;
s1.field1 = 1;
s1.field2 = "Hello S1";
s2.field1 = 2;
s2.field2 = "Hello S2";
s3.field1 = 3;
s3.field2 = "Hello S3";
writeln(s1.field1);
writeln(s1.field2);
writeln(s2.field1);
writeln(s2.field2);
writeln(s3.field1);
writeln(s3.field2);
}