-var thinF = function(){};
-thinF.prototype = super.prototype;
-sub.prototype = new thinF();
+}
+
+Summo.prototype = {
+ name: "Summo",
+ s_attr: null,
+
+ s_func: function()
+ {
+ this.a_func();
+ this.b_func();
+ this.c_func();
+ console.log("name: "+this.name);
+ }
+}
+
+Extends(Summo, A, B, C);
+
+function Extends(sub)
+{
+ var supers = [];
+
+ thinF = function(){};
+ tmp = new thinF();
+
+ console.log("INIZIO EXT");
+
+ var multi = function(sub, super, is_last)
+ {
+ var proto = super.prototype;
+
+ for (var f in proto) {
+ console.log("LOOP: "+f);
+ if( f != "constructor" && typeof(proto[f]) == "function" && is_last){
+ console.log("PR: "+proto['name']+" F: "+f);
+ // sub[f] = proto[f];
+ sub[f] = function(){
+ console.log("INFU PR: " + proto['name'] + " FUNC: "+f);
+ return proto[f].apply(this,arguments);
+ }
+ }
+ else {
+ console.log("PR: "+proto.name+" A: "+f+" FUN: "+proto[f]);
+ sub[f] = proto[f];
+ }
+ }
+ }
+
+ for( var i=1; i < arguments.length ; i++){
+ console.log("INIZIO LOOP");
+ multi(tmp, arguments[i], false);
+ supers.push(arguments[i].prototype);
+ }
+ multi(tmp, sub, true);
+ sub.prototype = tmp;
+}