Stack overflow at typesafe variadic constructors
    adel 
    adel4as at gmail.com
       
    Thu Jan 24 04:11:05 PST 2008
    
    
  
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);
}
    
    
More information about the Digitalmars-d-bugs
mailing list