
var mes=function(s){
    var e=document.getElementById("learn");
    e.innerHTML+=(s+"<br />");
}

function Animal(){

    this.life=1;
    this.eye=2;
    this.listup=function(x){
	mes("====");
	for ( i in x){
	    mes(i+" : "+x[i]);
	}
    };
}

var apo={
    fly:function(x){
	alert(x+" BATABATA<br />");
    }
}

function aho(){};

window.onload=function(){
    c=apo; // ハッシュでオブジェクト定義
    d=aho;
    e={}; // オブジェクトリテラルでオブジェクト定義  
    a=new Animal();
    
    (function(){
	var n=5;
	//    alert('A');
    })();
    //alert(n); // error(n is not defined)
    
    
    mes("====");
    
    function uho(){};
    //uho.__proto__=new Animal(); // 継承されない
    uho.prototype=new Animal; // 継承される
    
    s=new uho;
//    s.listup(s);
    
    function WorkerBee(){};

    function Hobbyist (hobby) {
	this.hobby = hobby || "scuba";
    }
    
    function Engineer (name, projs, mach, hobby) {
	this.base1 = WorkerBee;
	this.base1(name, "engineering", projs);
	this.base2 = Hobbyist;
	this.base2(hobby);
	this.machine = mach || "";
    }
    Engineer.prototype = new WorkerBee;
    //Engineer.prototype = new Hobbyist;
    
    dennis = new Engineer("Doe, Dennis", ["collabra"], "hugo")
    
    Hobbyist.prototype.equipment = ["mask", "fins", "regulapr", "bcd","MISSILE"]
    WorkerBee.prototype.shachiku="ready";
    
 //   s.listup(dennis);
}
