TclBlend: Blending Tcl and Java

By Scott Stanton

Dr. Dobb's Journal February 1998

(a) 
public class OverloadedSample {
    OverloadedSample(String s);
    OverloadedSample(int i);
}
OverloadedSample x = new OverloadedSample(42);
OverloadedSample y = new OverloadedSample("42");
(b)
set x [java::new { OverloadedSample int } 42]
set y [java::new { OverloadedSample String } 42]

Example 2: (a) Multiple constructors that take the same number of arguments; (b) how a script identifies which constructor should be used.

Back to Article


Copyright © 1998, Dr. Dobb's Journal