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 () {
80 arr_inst = [ a1 , a2 , b1 , c1 ];
81 arr_name = [ "a1", "a2", "b1", "c1" ];
83 print_dynstat(arr_inst, arr_name);
86 console.log("ACTION: a1.a_stat = \"CHANGED\";");
87 a1.a_stat = "CHANGED";
89 print_dynstat(arr_inst, arr_name);
92 console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED\"");
93 A.prototype.a_stat = "PROTO CHANGED";
95 print_dynstat(arr_inst, arr_name);
98 console.log("ACTION: ExtendsInst(c1, A, [1, 33])");
100 var ext = ExtendsInst(c1, A, [1, 33]);
101 console.log("ExtInst: "+(ext == true ? "TRUE" : "FALSE"));
102 // } function azaz() {
103 print_dynstat(arr_inst, arr_name);
106 console.log("ACTION: B.prototype.a_stat = \"PROTO CHANGED\"");
107 B.prototype.a_stat = "PROTO CHANGED";
109 print_dynstat(arr_inst, arr_name);
112 console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED 2\"");
113 console.log("ACTION: C.prototype.c_stat = \"PROTO CHANGED 2\"");
114 A.prototype.a_stat = "PROTO CHANGED 2";
115 C.prototype.c_stat = "PROTO CHANGED 2";
117 print_dynstat(arr_inst, arr_name);
120 console.log("=== INSTANCE b1 ===");
122 console.log("=== INSTANCE b1.a_func() ===");
124 console.log("=== INSTANCE b1.b_func() ===");
128 console.log("=== INSTANCE c1 ===");
130 console.log("=== INSTANCE c1.a_func() ===");
132 console.log("=== INSTANCE c1.aa_func() ===");
134 console.log("=== INSTANCE c1.callSuper aa_func() ===");
135 c1.callSuper("aa_func");
136 console.log("=== INSTANCE c1.c_func() ===");