重载跟继承是相结合的  继承请看 http://0x007.blog.51cto.com/6330498/1101578

 重载:

   子类当中的方法与父类当中的方法相同,则子类的方法就重写了父类的方法,既覆盖了父类当中的方法。

   子类的方法与父类的方法同名。

 例:

  1. <?php 
  2.  class ren { 
  3.    var $name,$sex,$age
  4.   
  5.   function  __construct($name,$sex,$age){ 
  6.      $this->name=$name
  7.      $this->sex=$sex
  8.      $this->age=$age
  9.       }  
  10.   function say(){ 
  11.     echo '我叫'.$this->name.'我的年龄是'.$this->sex.'我的年龄是'.$this->age.'<br/>'
  12.      }  
  13.  } 
  14.  class student extends ren { 
  15.   
  16.      var  $school
  17.   function  __construct($name,$sex,$age,$school){ 
  18.      $this->name=$name
  19.      $this->sex=$sex
  20.      $this->age=$age
  21.      $this->school=$school
  22.   }  
  23.   function say(){ 
  24.       echo "看到这句话说明子类的方法覆盖了父类的方法,这叫做重载".'<br/>'
  25.       echo "我的名字叫".$this->name.'我的年龄是'.$this->age; 
  26.    } 
  27.   function study(){ 
  28.      echo "我叫".$this->name.'我在'.$this->school.'学习'
  29.    } 
  30.  } 
  31.  
  32.  $p = new student ('0x007','男',19,'北京'); 
  33.  
  34.  //调用say方法(没有重载之前调用的是父类的,现在student已经重载asy方法 调用的就是student里面的say方法) 
  35.  $p -> say(); 
  36.  
  37.  //调用study方法 
  38.  $p -> study(); 
  39. ?>