码迷,mamicode.com
首页 > Web开发 > 详细

php extends

时间:2017-03-15 17:36:32      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:htm   echo   子类   html   parent   header   基类   extends   self   

header ("content-type:text/html;charset=utf-8");

class A{

  function __construct(){

    echo "基类的构造方法<br/>";

  }

}

class B extends A{

  function __construct(){

    parent::__construct();

    echo "子类B的构造方法<br/>";

    self::myfun();

  }

  function myfun(){

    echo "一个普通的方法:myfun()<br/>";

  }

}

$obj = new A();

$obj = new B();

 

php extends

标签:htm   echo   子类   html   parent   header   基类   extends   self   

原文地址:http://www.cnblogs.com/ayanboke/p/6555329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!