<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function Dog()
{
this.eat=function()
{
console.log(" 狗吃东西");
}
}
function Cat()
{
this.eat=function()
{
console.log("猫吃东西");
}
}
function feed(animal)
{
animal.eat();
}
let dog=new Dog();
feed(dog);
let cat=new Cat();
feed(cat);
</script>
</body>
</html>