title: PHP call inner class parents method without extending parent
body: <p>is it possible to call a parents method in a child class witch is not extended to its parent? I have something like that:</p>
  
  <pre><code>&lt;?php
  
  class wrapper {
  
      private $inner;
  
      public function __construct() {
          $this-&gt;inner = new inner();
      }
  
      // this will never get called :(
      public function foo() {
          echo "foo called in parent";
      }
  
      public function bar() {
          return $this-&gt;inner-&gt;bar();
      }
  
      public function getOtherStuff() {
          return $this-&gt;inner-&gt;blafasel;
      }
  }
  
  class inner { // would only be created in class wrapper, never outside
  
      public $blafasel;
  
      public function __construct() {
          // do something
          $this-&gt;blafasel = "other stuff";
      }
  
      public function bar() {
          // do stuff
          echo "bar called in inner";
  
          $this-&gt;foo();  // fatal error, method not declared
          parent::foo(); // fatal error, class has no parent
          // ??
          return "something"
      }
  }
  
  $test      = new wrapper();
  $something = $test-&gt;bar();
  
  ?&gt;
  </code></pre>
  
  <p>please dont ask why i've not using <code>class inner extends wrapper</code>. i have to use it like this cause of old stuff and other required things. So is it possible to call wrapper::foo without beeing static? wrapper is using some public variables of inner and stuff.<br>
  I've tried to add <code>$this</code> when calling the constructor of inner but that results only in an memory overflow or just a reflection of wrapper.
  So is it possible to call wrapper's foo() method in inner'b bar() or do i have to rewrite the whole thing so it could be using extended classes? I know i have to rewrite it but it would take weeks and i need this thing.. well.. yesterday.  </p>
  
  <p>Thanks for any help/hints/corrections :)</p>
  
  <h1>EDIT</h1>
  
  <p>There are more of <code>inner</code> classes that would be called in wrappers constructor, and all have (sort of) the same methods but do different stuff, depends on the inner class itself. (whole code is too long, even for pastebin)</p>
  
  <p>some snippets:</p>
  
  <pre><code>class wrapper {
      public function __construct($loadclass=1) {
          if($loadstuff==1)
              $this-&gt;inner = new inner();
          else
              $this-&gt;inenr = new otherinner();
      }
  }
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>class otherinner {
      public function bar() {
          // doing different stuff than inner::bar()
          // but call wrappers foo() may with possible args
      }
  }
  </code></pre>
  
  <p>i hope this will clear the "why not using extends"</p>