1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<?php class Person {
public $name = 'Devavrat';
private $email = '[email protected]';
protected $password='123456';
public function myresult() {
echo $this->name;
echo $this->email;
echo $this->password;
}
protected function onlyPass() {
echo $this->password;
}
}
class Special extends Person {
public function myaccess() {
return onlyPass();
}
}
$obj = new Special();
echo $obj->myaccess();
?>