| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx

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

0
PHP C/C++ 8772 次浏览

为什么不全是调用父类的属性?为什么只有$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();
?>

4个答案

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