1. function person(name){ 
  2. this._name=name; 
  3.  
  4. person.talk=function(){ 
  5.  
  6. document.write("I talk"); 
  7.  
  8.  
  9. person.prototype.say=function(){ 
  10.  
  11. document.write("my name is "+this._name); 
  12.  
  13. function man(name,sex){ 
  14.  
  15. person.call(this,name); 
  16. this._sex=sex; 
  17.  
  18.  
  19. man.prototype=new person();  //这一步是实现man继承person的say方法的关键 
  20. //但是这里依然会产生不必要的person里面的属性
  21.  
  22. man.prototype.shout=function(){ 
  23.  
  24. document.write("my name is "+this._name); 
  25. document.write("my sex is "+this._sex); 
  26.  
  27.  
  28. var mm=new man("lee","man"); 
  29. mm.say(); 
  30. mm.shout(); 
  31. //mm.talk();  //this is error