<?php
/**
* Abstract Surfer Class
*
* @package hangten
*/
abstract class Surfer
{
abstract public function rideWave($amplitude);
public function applyWax($waxType){
$this->printMessage("Ahh, all waxed up with '".$waxType."', ready to go!");
}
public function paddleOut(){
$this->printMessage("Paddling Out....");
}
public function screamShark(){
$this->printMessage("SHARK!!");
}
public function printMessage($msg = ""){
$lt = (isset($_SERVER['HTTP_USER_AGENT']))?"<br />":"\r\n";
print($msg.$lt);
}
}
/**
* RookieSurfer Class
*
* This surfer is green and can barely surf =)
* @package hangten
*/
class RookieSurfer extends Surfer
{
public function rideWave($amplitude = 1){
$this->printMessage("Trying.. Trying.. to ride a ".$amplitude."ft. wave, whew!");
}
}
/**
* ProSurfer Class
*
* This surfer is crazy skilled!!
* @package hangten
*/
class ProSurfer extends Surfer
{
public function rideWave($amplitude = 8){
$this->printMessage("Riding a ".$amplitude."ft. wave backwards doing a backflip!");
}
public function killSharkWithBoard(){
$this->printMessage("Totally just sliced that shark in two, he's over it!! booya!");
}
}
if(strnatcmp(phpversion(),'5.3.0') >= 0){
echo("Error : must have PHP version 5.3+ to run this script.");
exit();
}
// Rookie Instantiation
$rookie = new RookieSurfer;
$rookie->applyWax("Candle Wax");
$rookie->paddleOut();
$rookie->rideWave(2);
$rookie->screamShark();
// Pro Instantiation
$pro = new ProSurfer;
$pro->applyWax("Sex Wax");
$pro->paddleOut();
$pro->rideWave(50);
$pro->killSharkWithBoard();
Fatal error: Declaration of RookieSurfer::rideWave() must be compatible with that of Surfer::rideWave() in /in/od6Lb on line 41
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/od6Lb on line 8
Process exited with code 255.