为什么$pri用的是父类的属性?

0
PHP C/C++ 27614 次浏览

为什么不全是调用父类的属性?为什么只有$pri用的是父类的私有属性?

<?php
class father {
  public $pub='public';
  private $pri='private';
  protected $pro='protected';
  public function getpri(){
    echo $this->pri;
    echo $this->pro;
    echo $this->pub;
  }
}
class son extends father{
  public $pub='王二';
  private $pri='黄金时代';
  protected $pro='沉默的大多数';
  public function getpub(){
    echo $this->pub.'';
    echo $this->pro;
    echo $this->pri;
  }
}
$son=new son;
$son->getpri();
?>
请尽量让自己的答案能够对别人有帮助

19个答案

默认排序 按投票排序
0

Thanks for this information and solutions posted! siding springfield va

0

Amazing information/solution! Thank you so much! Ashburn towingroadside assistance

0

Thanks a lot for sharing this solution! Keep it up! towing Columbia SC

0

This is great! Thanks for sharing such valuable article. roofing contractor Arlington VA

0

I really appreciate this great post that you have provided us. I guarantee this will benefit most people and myself. thank you very much!

vin lookup

0

Great information! Thanks for articles and comments here. drain cleaning

0

Thank you for sharing this information with us.slotxo

0

本文页面的内容,我发现内容对我来说非常有趣和有用,谢谢分享 点击这里

0

The information you share is necessary for me, I've been looking for it for a few days and it helped me get my job done. driving directions

0

北京开发者中心 http://010kfzzx.wikidot.com/
广州开发者中心 http://020kfzzx.wikidot.com/
上海开发者中心 http://021kfzzx.wikidot.com/
成都开发者中心 http://028kfzzx.wikidot.com/
西安开发者中心 http://029kfzzx.wikidot.com/
天津开发者中心 http://022kfzzx.wikidot.com/
重庆开发者中心 http://023kfzzx.wikidot.com/
沈阳开发者中心 http://024kfzzx.wikidot.com/
南京开发者中心 http://025kfzzx.wikidot.com/
武汉开发者中心 http://027kfzzx.wikidot.com/
昆明开发者中心 http://0871kfzzx.wikidot.com/
东莞开发者中心 http://0769kfzzx.wikidot.com/
深圳开发者中心 http://0755kfzzx.wikidot.com/
惠州开发者中心 http://0752kfzzx.wikidot.com/
连云港开发者中心 http://0518kfzzx.wikidot.com/

0

Delicious and nutritious. I will learn to make this dish.
geometry dash

0

thanks and nice to see about live train updates

0

Thanks for sharing this codes.

Check this out postknight pets

0

The article is exceptionally good and straightforward. This is precisely what I require.  text twist
 

0

This article is really fantastic and thanks for sharing the valuable post.

Raft Wars 2

1

得到的

0

test