<body>
<?php
class A
{
public $pub_A; private $pri_A;
public function pub()
{
$this->pub_A = 'It is public of A!';
echo "<p>".$this->pub_A."</p>";
}
protected function pri()
{
$this->pri_A = 'It is private of A!';
echo "<p>".$this->pri_A."</p>";
}
}
class B extends A
{
public $pub_B;
private $pri_B;
function __construct()
{
echo "<p>".$this->pri()."</p>"; $this->pri_A = 10; echo "<p>".$this->pri_A."</p>";
}
}
$b = new B;