<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
function Animal(color,sex){
this.color = color;
this.sex = sex;
}
function Dog(color,sex,name){
Animal.call(this,color,sex);
this.name = name;
}
Dog.prototype.wang = function (){console.log("汪汪汪");};
function Cat(color,sex,name){
Animal.call(this,color,sex);
this.name = name;
}
Cat.prototype.miao = function (){console.log("喵喵喵");};
var oDog = new Dog("黄","公","Q");
console.log(oDog);
oDog.wang();
</script>
</body>
</html>