<?php
/**
* Abstract Surfer Class
*
* @package hangten
*/
abstract class Surfer
{
abstract protected function rideWave($amplitude);
public function applyWax($waxType){
echo("Ahh, all waxed up with '".$waxType."'. Ready to go!<br />");
}
public function paddleOut(){
echo("Paddling....<br />");
}
public function screamShark(){
echo("SHARK!!<br />");
}
}
/**
* RookieSurfer Class
*
* This surfer is green and can barely surf.
* @package hangten
*/
class RookieSurfer extends Surfer
{
protected function rideWave($amplitude = 1){
echo("Trying.. Trying.. to ride a ".$amplitude."ft. wave, whew!<br />");
}
}
/**
* ProSurfer Class
*
* This surfer is crazy skilled!!
* @package hangten
*/
class ProSurfer extends Surfer
{
protected function rideWave($amplitude = 8){
echo("Riding a ".$amplitude."ft. wave backwards doing a backflip!");
}
public function killSharkWithBoard(){
echo("totally just sliced that shark in two!! booya!");
}
}
$rookie = new RookieSurfer;
$rookie->applyWax("Candle Wax");
$rookie->paddleOut();
$rookie->rideWave(2);
$rookie->screamShark();
$pro = new ProSurfer;
$pro->applyWax("Sex Wax");
$pro->paddleOut();
$pro->rideWave(50);
$pro->killSharkWithBoard();
Ahh, all waxed up with 'Candle Wax'. Ready to go!<br />Paddling....<br />
Fatal error: Uncaught Error: Call to protected method RookieSurfer::rideWave() from global scope in /in/kQqL8:59
Stack trace:
#0 {main}
thrown in /in/kQqL8 on line 59
Process exited with code 255.
Ahh, all waxed up with 'Candle Wax'. Ready to go!<br />Paddling....<br />
Fatal error: Uncaught Error: Call to protected method RookieSurfer::rideWave() from context '' in /in/kQqL8:59
Stack trace:
#0 {main}
thrown in /in/kQqL8 on line 59
Process exited with code 255.
Ahh, all waxed up with 'Candle Wax'. Ready to go!<br />Paddling....<br />
Fatal error: Call to protected method RookieSurfer::rideWave() from context '' in /in/kQqL8 on line 59
Process exited with code 255.
Fatal error: Declaration of RookieSurfer::rideWave() must be compatible with that of Surfer::rideWave() in /in/kQqL8 on line 36
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/kQqL8 on line 8
Process exited with code 255.