January 24, 2008 Stack overflow at typesafe variadic constructors | ||||
---|---|---|---|---|
| ||||
this is work (for functions): ====================================================== class Rect { public int x; public int y; public int w; public int h; public this(int x, int y, int w, int h) { this.x = x; this.y = y; this.w = w; this.h = h; } void rect(Rect r ...) { this.x = r.x; this.y = r.y; this.w = r.w; this.h = r.h; } } void main() { Rect r = new Rect(1,2,3,4); r.rect(1,2,3,4); } this is not work (for constructors): ====================================================== class Rect { public int x; public int y; public int w; public int h; public this(Rect r ...) { this.x = r.x; this.y = r.y; this.w = r.w; this.h = r.h; } } void main() { Rect r = new Rect(1,2,3,4); } |
Copyright © 1999-2021 by the D Language Foundation