title: Overriding not working Codeigniter php
body: <p>I am trying to create a role based system so i found this tutorial online :</p>
  
  <p><a href="https://www.youtube.com/watch?v=eOzmO61CsVg&amp;t=619s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=eOzmO61CsVg&amp;t=619s</a></p>
  
  <p>so i started creating the Controllers by watching the videos.</p>
  
  <p>after i created MY_Controller class I extended the Page Class to MY_Controller class and override the <code>$access</code> variable to check whether it is working or not, I tried to print the <code>$access</code> variable in MY_Controller Class</p>
  
  <p>but it is always giving * when i do die, may be i am doing something wrong.</p>
  
  <p>below is the code :</p>
  
  <p><strong>MY_Controller Class :</strong></p>
  
  <pre><code>class MY_Controller extends CI_Controller {
  
  /**
  * '*' all user
  * '@' logged in user
  * 'Hospital' for hospital users
  * 'Reciever' for recievers
  * @var string
  */
  
  private $access = "*";
  
  public function __construct() {
  
      parent::__construct();
  
      $this-&gt;login_check();
  }
  
  public function login_check(){
      if ($this-&gt;access != "*") 
      {
          // here we check the role of the user
          if (! $this-&gt;permission_check()) {
              die("&lt;h4&gt;Access denied&lt;/h4&gt;");
          } 
  
          // if user try to access logged in page
          // check does he/she has logged in
          // if not, redirect to login page
          if (! $this-&gt;session-&gt;userdata("logged_in")) {
              redirect("auth");
          }
      }
  
  
      die($this-&gt;access);
  }
  
  
  
      public function permission_check(){
          if ($this-&gt;access == "@") {
              return true;
          }
          else
          {
              $access = is_array($this-&gt;access) ? 
                  $this-&gt;access :
                  explode(",", $this-&gt;access);
              if (in_array($this-&gt;session-&gt;userdata("role"), array_map("trim", $access)) ) {
                  return true;
              }
  
              return false;
          }
      }
  }
  </code></pre>
  
  <p><strong>Pages Class :</strong> </p>
  
  <pre><code>class Pages extends MY_Controller {
  
      protected $access="Admin";
  
      public function view($page='available_samples') {
  
          if(!file_exists(APPPATH.'views/pages/'.$page.'.php')){
              show_404();
          }
  
          $data['title'] = $page;
  
          $this-&gt;load-&gt;view('templates/header',$data);
          $this-&gt;load-&gt;view('pages/'.$page);
          $this-&gt;load-&gt;view('templates/footer');
      }
  }
  </code></pre>
  
  <p><strong>What i am getting</strong> </p>
  
  <p>i am getting <code>$access</code> variable value as * always.</p>
  
  <p><strong>Expected Behaviour</strong> </p>
  
  <p>the value of <code>$access</code> variable in Pages class should override the access variable value in the MY_Controller class.</p>