function Cat (name,age) {
this.name = name;
this.age = age;
}
Cat.prototype.type = "猫科动物";
Cat.prototype = {
say:function(){
console.log("喵咪~~~");
},
run:function(r){
console.log("我的跑动速度是:"+r);
}
}
var c = new Cat();
function Cat (name,age) {
this.name = name;
this.age = age;
}
Cat.prototype.type = "猫科动物";
Cat.prototype = {
say:function(){
console.log("喵咪~~~");
},
run:function(r){
console.log("我的跑动速度是:"+r);
}
}
var c = new Cat();
本文标题:js-对象封装
本文链接:https://www.haomeiwen.com/subject/cjjuyttx.html
网友评论