fork download
  1. import std.stdio;
  2.  
  3. template X()
  4. {
  5. int _len = 0;
  6. int Length() { return _len; }
  7. int length(this T)() { return (cast(T)this).Length(); }
  8. }
  9.  
  10. template Y()
  11. {
  12. mixin X;
  13. int Length() { return 3; }
  14. }
  15.  
  16. struct A {mixin Y;}
  17.  
  18. void main(string[] args)
  19. {
  20. A a;
  21. a.length.writeln;
  22. }
Success #stdin #stdout 0s 2672KB
stdin
Standard input is empty
stdout
3