11 console.log("a_func run");
13 aa_func: function () {
14 console.log("aa_func run in A class");
27 console.log("a_func run from B");
28 console.log("and now try to call the super method");
29 this.callSuper("a_func");
33 console.log("b_func run");
43 aa_func: function () {
44 console.log("aa_func run in C class");
48 console.log("c_func run");
54 function print_dynstat(inst, name)
56 for (i = 0 ; i < inst.length ; i++) {
57 console.log(name[i]+".a_dyn: "+inst[i].a_dyn);
58 console.log(name[i]+".a_stat: "+inst[i].a_stat);
59 if (name[i][0] == 'b') {
60 console.log(name[i]+".b_dyn: "+inst[i].b_dyn);
61 console.log(name[i]+".b_stat: "+inst[i].b_stat);
63 if (name[i][0] == 'c') {
64 console.log(name[i]+".c_dyn: "+inst[i].c_dyn);
65 console.log(name[i]+".c_stat: "+inst[i].c_stat);
70 window.onload = function () {
71 console.log("Window.onload: begin");
81 arr_inst = [ a1 , a2 , b1 , c1 ];
82 arr_name = [ "a1", "a2", "b1", "c1" ];
84 print_dynstat(arr_inst, arr_name);
87 console.log("ACTION: a1.a_stat = \"CHANGED\";");
88 a1.a_stat = "CHANGED";
90 print_dynstat(arr_inst, arr_name);
93 console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED\"");
94 A.prototype.a_stat = "PROTO CHANGED";
96 print_dynstat(arr_inst, arr_name);
99 console.log("ACTION: ExtendsInst(c1, A, [1, 33])");
101 var ext = ExtendsInst(c1, A, [1, 33]);
102 console.log("ExtInst: "+(ext == true ? "TRUE" : "FALSE"));
103 // } function azaz() {
104 print_dynstat(arr_inst, arr_name);
107 console.log("ACTION: B.prototype.a_stat = \"PROTO CHANGED\"");
108 B.prototype.a_stat = "PROTO CHANGED";
110 print_dynstat(arr_inst, arr_name);
113 console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED 2\"");
114 console.log("ACTION: C.prototype.c_stat = \"PROTO CHANGED 2\"");
115 A.prototype.a_stat = "PROTO CHANGED 2";
116 C.prototype.c_stat = "PROTO CHANGED 2";
118 print_dynstat(arr_inst, arr_name);
121 console.log("=== INSTANCE b1 ===");
123 console.log("=== INSTANCE b1.a_func() ===");
125 console.log("=== INSTANCE b1.b_func() ===");
129 console.log("=== INSTANCE c1 ===");
131 console.log("=== INSTANCE c1.a_func() ===");
133 console.log("=== INSTANCE c1.aa_func() ===");
135 console.log("=== INSTANCE c1.callSuper aa_func() ===");
136 c1.callSuper("aa_func");
137 console.log("=== INSTANCE c1.c_func() ===");