久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php調(diào)用父類構(gòu)造方法是什么

      php調(diào)用父類構(gòu)造方法:首先父類先構(gòu)造函數(shù),代碼為【public function __construct()】;然后使用【parent::__construct()】調(diào)用父類構(gòu)造函數(shù)即可。

      php調(diào)用父類構(gòu)造方法是什么

      php調(diào)用父類構(gòu)造方法:

      一、使用函數(shù)【parent::__construct()】調(diào)用父類構(gòu)造函數(shù)

      代碼如下;

      <?php class MyClass    //父類 {     public function __construct()    //父類構(gòu)造函數(shù) {     echo "父類的構(gòu)造函數(shù)"; } } class ChildClass extends MyClass     //子類  {     public function __construct()    //子類構(gòu)造函數(shù) {         echo "子類的構(gòu)造函數(shù)"."<br>";         parent::__construct();    //調(diào)用父類構(gòu)造函數(shù)     } } $childClass = new ChildClass();    //對(duì)類的實(shí)例化 ?>

      二、運(yùn)行結(jié)果

      子類的構(gòu)造函數(shù)

      父類的構(gòu)造函數(shù)

      相關(guān)學(xué)習(xí)推薦:php編程(視頻)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)