gecko-dev/js/js2/tests/constructors.js
2000-11-07 00:58:42 +00:00

23 lines
444 B
JavaScript

load("verify.js");
class C {
var a:String;
constructor C(p:String) {this.a = "New "+p}
constructor make(p:String) {this.a = "Make "+p}
static function obtain(p:String):C {return new C(p)}
}
var c:C = new C("one");
var d:C = C.C("two");
var e:C = C.make("three");
var f:C = C.obtain("four");
verify( c.a, "New one" );
verify( d.a, "New two" );
verify( e.a, "Make three" );
verify( f.a, "New four" );