function inherit(parent, proto)
{
	var prototype = {};
	
	for(property in parent.prototype){
		prototype[property] = parent.prototype[property];
	}
	
	for(property in proto){
		prototype[property] = proto[property];
	}
	
	return prototype;
}


function Dog(name)
{
	this.name = name;
}

Dog.prototype = inherit(Pet, {
	takeANap:function()
	{
		alert(this.name+" is sleeping");
	}
})

var aDog = new Dog("doggy");
alert(aDog.getName());
aDog.takeANap();

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2008-08-27 17:32:32
Processing time 0.0047 sec