php class User extends AUser public static countUser public function _

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
class User extends AUser{
public static $countUser = 0;
public function __construct($name, $login, $password){
++self::$countUser;
}
}
class SuperUser extends User implements ISuperUser{
public static $countSUser = 0;
public function __construct($name, $login, $password, $role){
++self::$countSUser;
}
}
echo 'Всего обычных пользователей: '. User::countUser;
echo 'Всего супер-пользователей: '. SuperUser::countSUser;
?>