PHP classes, inheriting, implements
<p>I am looking at <a href="http://stackoverflow.com/questions/3548253/should-i-use-multiple-classes-for-game">Should I use multiple classes for game?</a> - Robert Pitt's answer.</p>

<pre><code>interface Weapons {

    public function Fire();

}

class Colt implements Weapons {

    function Fire() {
        echo 'Fire!';
    }

}

abstract class Human implements Colt
{

}

class Sniper extends Human
{
    public function __construct()
    {

    }



}
</code></pre>

<p>On the "Human" am I perhaps to implement the "Weapons" rather then Colt, and then on the "Sniper" initialize the Right weapon class?</p>

<pre><code>class Sniper extends Human
{
public $weapon;

    public function __construct($weapon)
    {
    $this-&gt;weapon = new $weapon;  
    }


$this-&gt;weapon-&gt;fire();


}
</code></pre>

<p>Or something like that? I am confused of how it works..</p>

<pre><code>EXAMPLE 1

class A {
public $class;

__construct() {
$this-&gt;class = new $class;
}

hello() {
$this-&gt;class-&gt;hello();
}
}

class B {
public function hello() {
echo 'hi';
}
}
</code></pre>
