- function Person(name,age){
- this.name=name;
- this.age=age;
- }
- Person.prototype.getName=function(){
- return this.name;
- }
- Person.prototype.getAge=function(){
- return this.age;
- }
- function Person_Lxl(name,age,school){
- Person.apply(this,arguments);
- this.school=school;
- this.info=function(){
- alert(this.getName()+" , "+this.getAge()+" , "+this.getSchool());
- }
- }
- Person_Lxl.prototype=new Person();
- Person_Lxl.prototype.getSchool=function(){
- return this.school;
- }
- Person_Lxl.prototype.info=function(){
- alert(this.getName()+" , "+this.getAge()+" , "+this.getSchool());
- }
- var p=new Person_Lxl("lxl",25,"zh");
- var p1=new Person_Lxl("lhw",1,"yz");
- alert(p.getName()+" , "+p.getAge()+" , "+p.getSchool());
- alert(p1.getName()+" , "+p1.getAge()+" , "+p1.getSchool());
- p.info();