function object(o){
function F(){}
F.prototype=o;
return new F();
}
/*------------------function unit----------------------*/
function inheritPrototype(childClass,ParentClass){
var prototype=object(ParentClass.prototype);
prototype.constructor=childClass;
childClass.prototype=prototype;
}
/*------------------function unit----------------------*/
/*------------------Person----------------------*/
function Person(name,age,sex,job){
//prototype
this.name=name;
this.age=age;
this.sex=sex;
this.job=job;
}
//function
Person.prototype={
constructor:Person,
sayName:function(){
alert(this.name);
}
}
/*------------------Person----------------------*/
/*------------------Teacher----------------------*/
function Teacher(name,age,sex,job,teachCourse,stuCount,ClassNo){
//prototype
Person.call(this,name,age,sex,job);
this.teachCourse=teachCourse;
this.stuCount=stuCount;
this.ClassNo=ClassNo;
}
inheritPrototype(Teacher,Person);
//function
Teacher.prototype.showTeachCourse=function (){
alert(teachCourse.join("|"));
}
/*------------------Teacher----------------------*/
/*------------------Student----------------------*/
function Student(name,age,sex,job,learnCourse,teachers,locClassCount){
//prototype
Person.call(this,name,age,sex,job);
this.learnCourse=learnCourse;
this.teachers=teachers;
this.locClassCount=locClassCount;
}
inheritPrototype(Student,Person);
//function
Student.prototype.showLearnCourse=function(){
alert(learnCourse.join("|"));
}
/*------------------Student----------------------*/