title: In php,how to a class has all methods of another class?
body: <p>In php,I have two classes:</p>
  
  <pre><code>Class A
  {
      public function a1()
      {
          ...
      }
      public function a2()
      {
          ...
      }
  
      more methods.
  
  }
  Class B
  {
      private $b=new A();
  }
  </code></pre>
  
  <p>I wanna B has all methods of class A.But I don't want to rewrite a1(),a2()... in class B.
  It's too much trouble.Is there any better way?<br />
  Thanks.</p>
  
  <p>I'm so sorry. I think my example code is not quite right.
  The following is new class B:</p>
  
  <pre><code>class B
  {
      private static $a=new A();
  }
  </code></pre>
  
  <p>I'd like multiple instances of B share a instance of A.<br />So I think inheritance is not enough.<br />Thanks.</p>