Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Main Account System Class
- abstract class Accounts {
- protected $name;
- protected $email;
- protected $hasPremium;
- protected $openTrades;
- protected $completedTrades;
- public function __construct($name, $email, $hasPremium = false)
- {
- $this->name = $name;
- $this->email = $email;
- $this->hasPremium = $hasPremium;
- }
- public function checkPremium()
- {
- return $this->hasPremium;
- }
- }
- // Administrative Account Child Class
- class Admins extends Accounts {
- public function __construct()
- {
- $this->hasPremium = true;
- }
- }
- // Normal User Account Class
- class Users extends Accounts {
- }
- // Instantiate a new user object and check to see if the user has a premium account or not
- if ($user->checkPremium() === false)
- {
- echo "User does not have premium access";
- }
- else
- {
- echo "User has premium access";
- }
Add Comment
Please, Sign In to add comment