php class SuperUser extends User public role public function __constru

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php
class SuperUser extends User{
public $role;
public function __construct($name, $login, $password, $role){
$this->role = $role;
parent::__construct($name, $login, $password);
}
public function showInfo(){
parent::showInfo();
echo $this->role.'<br>';
}
}
$user = new SuperUser('Super', 'super', 'qazxsw', 'admin');
$user->showInfo();
?>