<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS面向对象</title>
</head>
<body>
<script>
function Animal(a) {
this.a = a
}
Animal.prototype.breath = function () {
alert("吃饭");
}
function Sleep(a) {
Animal.call(this, a);
}
Sleep.prototype = new Animal();
Sleep.prototype.shout = function () {
alert("睡觉")
}
var b = new Sleep(100);
hyh.breath();
hyh.shout();
</script>
</body>
</html>