📄 fish.js
字号:
/**
* 鱼类
* @constructor
*/
function Fish(){
}
/**
* 鱼类也是动物
*/
Fish.prototype = new Animal();
/**
* 进食,有误食鱼饵的危险
*/
Fish.prototype.eat = function(food){
if(food instanceof Bait){
//误食鱼饵,被抓
food.owner.acquisition = this;
}else{
//do eating
}
}
/**
* 定义Fish对象作为String操作的时候的值
*/
Fish.prototype.toString = function(){
return "Fish instance";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -