function Person(name, email, website){
this.name = 'x';
this.getName = function (){
console.log(this.name + ' ' + name);
};
this.getEmail = function (){
console.log(email);
};
this.getWebSite = function (){
console.log(website);
};
};
function Programmer(name, email, website){
//构造父类,参数是数组arguments
Person.apply(this, arguments);
this.aliasName = '';
}
window.onload = init;
function init(){
var p = new Programmer('zimin','ziminy@qq.com','www.ziminy.com');
p.getName();
}
评论