<script>
function Animal(thk) {
this.thk = thk
}
Animal.prototype.breath = function () {
alert("吃饭");
}
function Sleep(thk) {
Animal.call(this, thk);
}
Sleep.prototype = new Animal();
Sleep.prototype.shout = function () {
alert("睡觉")
}
var thk = new Sleep(100);
thk.breath();
thk.shout();
</script>