title: Calling Parent Class From Sub Class PHP
body: <p><a href="https://stackoverflow.com/questions/742097/this-a-b-c-d-calling-methods-from-a-superclass-in-php">$this-&gt;a-&gt;b-&gt;c-&gt;d calling methods from a superclass in php</a></p>
  
  <p>Ive asked a question on this link I ve problem with this tecnique I am able to call the sub classes from a class </p>
  
  <p>like this</p>
  
  <p>$chesterx->db->query();</p>
  
  <p>I wanna do get another class from sub class </p>
  
  <p>for example</p>
  
  <p>i want to query execute which was come from the sql class </p>
  
  <pre><code>            ROOT
               |
  sql &lt;---  chesterx ---&gt;  db
  </code></pre>
  
  <p>i wanna use the sql class from db </p>
  
  <p>the problem i cant return the chesterx class from db class </p>
  
  <p>/<em>edit</em>/</p>
  
  <p>I have some classes like news, members, categories, db and query </p>
  
  <p>and i did it like the link which was on the subject top</p>
  
  <p>public function __construct(){</p>
  
  <pre><code>    function __construct(){  
        if(!$this-&gt;db){                                       
                   include(ROOT."/func/class/bp.db.class.php");
                   $this-&gt;db = new db;
              }
  if(!$this-&gt;chester){                                        
                   include(ROOT."/func/class/bp.chester.class.php");
                   $this-&gt;db = new chester;
              }
          }
  </code></pre>
  
  <p>i called the db class with this code and now i am able to call and use the db class methods well</p>
  
  <p>for example </p>
  
  <p>i want to use a method from db </p>
  
  <p>that method is containing a value which was returning a data from the chester class's method</p>
  
  <p>i wish i were clarify myself
  /<em>edit</em>/</p>
  
  <p>is there anyway to do this?</p>