var A = function(name){
this.name=name;
}
A.prototype = {
sayName:function(){
alert(this.name);
}
}
var B = function(age){
this.age = age;
}
B.prototype = {
sayAge : function(){
alert(this.age)
}
}
//function C(){};
var c = new C("white",25);
c.sayName();
c.sayAge();
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
方法一
方法二
方法三