function Parent(name){
this.name=name;
this.sayHello=function(){
alert(this.name);
}
}
function child(name,hobby){
this.method=Parent;
/*
调用Parent()函数,添加了name,sayHello属性
*/
this.method(name);
delete this.method;
}
var ch=new child("小张","打酱油");
ch.sayHello();