Re: Re: Repetitive answers . . .
| From: | Joshua Stoutenburg | Date: | Fri, 16 Sep 2011 07:56:03 +0000 |
| Subject: | Re: Re: Repetitive answers . . . | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314895@lists.php.net to get a copy of this message | ||
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 :)