Advertisement
Guest User

Untitled

a guest
Feb 19th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. class Authenticate {
  4.     private $user;
  5.    
  6.     function __construct(User $user) {
  7.         $this->user = $user;
  8.     }
  9.    
  10.     function authenticate() {
  11.         return true;
  12.     }
  13. }
  14.  
  15. class User {
  16.     private $username;
  17.     private $password;
  18.    
  19.     function __construct($username, $password) {
  20.         $this->username = $username;
  21.         $this->password = $password;
  22.     }
  23.    
  24.     public function login() {
  25.         $a = new Authenticate($this);
  26.         return $a->authenticate();
  27.     }
  28. }
  29.  
  30. $U = new User('carress', 'carrots');
  31.  
  32. $U->login();
  33.  
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement