On Fri, Sep 16, 2011 at 12:35 AM, tamouse mailing lists
>
> My baboon is offended.
>
class baboon extends human
{
$ammo = '';
public __construct($ammo)
{
$this->ammo = $ammo;
}
public function flingAt($target)
{
$target->flingAlert($this, $this->ammo);
}
public function flingAlert($source, $missile)
{
$hit = rand(0,1);
if ($hit == 1)
{
$this->screech();
}
else {
$this->howl();
}
// regardless, return the favor
$this->flingAt($souce);
}
private function howl()
{
echo "Oooaa-oooaa";
}
private function screech()
{
echo "Eeeee";
}
}
$ammo = "stuff";
$me = new baboon($ammo);
$you = new baboon($ammo);
$me->flingAt($you);
// :) This is pretty fun :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php