first simple inheritance function
authorMatteo Nastasi <matteo.nastasi@lucinilucini.com>
Tue, 15 Nov 2011 18:15:47 +0000 (19:15 +0100)
committerMatteo Nastasi <matteo.nastasi@lucinilucini.com>
Tue, 15 Nov 2011 18:15:47 +0000 (19:15 +0100)
prova.html [new file with mode: 0644]

diff --git a/prova.html b/prova.html
new file mode 100644 (file)
index 0000000..d784c1e
--- /dev/null
@@ -0,0 +1,122 @@
+<html>
+<head>
+<script type="text/javascript" src="commons.js"></script>
+<script type="text/javascript" src="xynt-dd.js"></script>
+<script type="text/javascript" src="xynt-link.js"></script>
+<script type="text/javascript">
+
+function Adamo() {
+    this.name = "adamo";
+}
+
+Adamo.prototype = {
+    alupa: null,
+
+    pname: function()
+    {
+        console.log("NAME: "+this.name);
+    }
+}
+
+function Caino() {
+    this.super.constructor.call(this);
+    this.nname = "caino";
+}
+
+Caino.prototype = {
+    gojira: null,
+
+    pname2: function()
+    {
+        console.log("NAME:  "+this.name);
+        console.log("NNAME: "+this.nname);
+    }
+}
+
+function Extends(sub, super)
+{
+    var thinF = function(){};
+    thinF.prototype = super.prototype;
+    var tmp = new thinF();
+
+    for( var f in sub.prototype) {
+        tmp[f] = sub.prototype[f];
+        tmp['constructor'] = sub;
+    }
+    if( super.prototype.constructor == Object.prototype.constructor ){
+        super.prototype.constructor = super;
+    }
+    tmp['super'] = super.prototype;
+    sub.prototype = tmp;
+}
+
+Extends(Caino, Adamo);
+
+var c = new Caino();
+
+console.log("A"+c.alupa);
+console.log("G"+c.gojira);
+console.log("U"+c.unko);
+
+c.pname();
+c.pname2();
+
+
+
+if (0 == 1) {
+var thinF = function(){};
+thinF.prototype = super.prototype;
+sub.prototype = new thinF();
+sub.prototype.constructor = sub;
+sub.super = super.prototype;
+if( super.prototype.constructor == Object.prototype.constructor ){
+    super.prototype.constructor = super;
+}
+
+var a = new Adamo();
+var c = new Caino();
+
+
+c.pname();
+}
+
+/*
+
+var thinF = function(){};
+thinF.prototype = super.prototype;
+sub.prototype = new thinF();
+
+05.    sub.prototype.constructor = sub;
+06.    sub.super = super.prototype;
+07.    if( super.prototype.constructor == Object.prototype.constructor ){
+08.    super.prototype.constructor = super;
+*/
+
+</script>
+
+</head>
+<body>
+<!-- task:begin -->
+<div id="board" style="width: 1600; height: 800px; background-color: #f0f0f0; border: 1px solid black; position: relative;">
+  <div id="r1" style="width: 1600; height: 40px; left: 0px; top: 0px; background-color: #e8e8e8; border: 0px solid red; position: absolute;">
+    <div id="t1" style="z-index: 1; left: 10px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0c0ff; position: absolute;"></div>
+  </div>
+  
+  <div id="r2" style="width: 1600;  left: 0px; top: 40px; height: 40px; background-color: #e8e8ff; border: 0px solid red; position: absolute;">
+    <div id="t2" style="z-index: 1; left: 123px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0ffc0; position: absolute;"></div>
+  </div>
+
+  <div id="r3" style="width: 1600; height: 40px; left: 0px; top: 80px; background-color: #e8e8e8; border: 0px solid red; position: absolute;">
+    <div id="t3" style="z-index: 1; left: 10px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0c0ff; position: absolute;"></div>
+  </div>
+  
+  <div id="r4" style="width: 1600;  left: 0px; top: 120px; height: 40px; background-color: #e8e8ff; border: 0px solid red; position: absolute;">
+    <div id="t4" style="z-index: 1; left: 123px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0ffc0; position: absolute;"></div>
+  </div>
+  
+  <!-- task:end -->
+  
+  
+</div>
+</body>
+</html>