Initial contents of objects [as output by dumpObjects()]...
put dump here
Class(A,["acorn count"]);
function A()
{
this.konstructor = function(p1){ this.a = p1; }
this.sayHi = function(){ alert("Howdy!"); }
this.sayBye = function(){ alert("Bye!"); }
this.dumpvars = function(){ return " a="+this.a; }
this.dump = function(){ return "["+this.dumpvars()+" ]"; }
}
Class(B,["acorn portion","bananas"]).Extends(A);
function B()
{
this.konstructor = function(p1,p2){ this.souper(p1); this.b = p2; }
this.dumpvars = function(){ return this.souper()+" b="+this.b; }
this.sayBye = function(){ alert("Aloha!"); }
}
Class(C).Extends(B);
function C()
{ //invoke B constructor directly
this.konstructor = function(p1,p2,p3){ this.B(p1,p2); this.c = p3; }
this.dumpvars = function(){ return this.souper()+" c="+this.c; }
this.sayHi = function(){ this.souper(); alert("Y'all"); }
}
var gA = new A(1);
var gB = new B(2,3);
var gC = new C(4,5,6);
var gX;
// test not passing enough constructor arguments (which is not legal)
try { gX = new B(2); }
catch(e) { alert("caught:["+e+"]"); }
// test passing null to required constructor argument (which is legal)
try { gX = new B(2,null); }
catch(e) { alert("caught:["+e+"]"); }
// test undefined required constructor argument (which is not legal)
try { gX = new B(2,undefined); }
catch(e) { alert("caught:["+e+"]"); }
function dumpObjects()
{
var s = "gA:("+gA.name+")" + gA.dump() + "[br/]"
+ "gB:("+gB.name+")" + gB.dump() + "[br/]"
+ "gC:("+gC.name+")" + gC.dump() + "[br/]";
document.getElementById("OutputArea").innerHTML = s;
}