<?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!");
}
public function paddleOut(){
echo("Paddling....");
}
public function screamShark(){
echo("SHARK!!");
}
}
/**
* 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!");
}
}
/**
* 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!");
}
}
$rookie = new RookieSurfer;
$rookie->applyWax('candleWax')
->$rookie->paddleOut()
->$rookie->rideWave(2);
Ahh, all waxed up with 'candleWax'. Ready to go!
Warning: Attempt to read property "" on null in /in/RJ5au on line 54
Fatal error: Uncaught Error: Object of class RookieSurfer could not be converted to string in /in/RJ5au:54
Stack trace:
#0 {main}
thrown in /in/RJ5au on line 54
Process exited with code 255.
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Ahh, all waxed up with 'candleWax'. Ready to go!
Notice: Trying to get property '' of non-object in /in/RJ5au on line 54
Fatal error: Uncaught Error: Object of class RookieSurfer could not be converted to string in /in/RJ5au:54
Stack trace:
#0 {main}
thrown in /in/RJ5au on line 54
Process exited with code 255.
Output for 7.4.26
Ahh, all waxed up with 'candleWax'. Ready to go!
Fatal error: Uncaught Error: Object of class RookieSurfer could not be converted to string in /in/RJ5au:54
Stack trace:
#0 {main}
thrown in /in/RJ5au on line 54
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Ahh, all waxed up with 'candleWax'. Ready to go!
Recoverable fatal error: Object of class RookieSurfer could not be converted to string in /in/RJ5au on line 54
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Ahh, all waxed up with 'candleWax'. Ready to go!
Notice: Trying to get property of non-object in /in/RJ5au on line 54
Fatal error: Uncaught Error: Call to a member function paddleOut() on null in /in/RJ5au:54
Stack trace:
#0 {main}
thrown in /in/RJ5au on line 54
Process exited with code 255.
Output for 5.6.0 - 5.6.25
Ahh, all waxed up with 'candleWax'. Ready to go!
Notice: Trying to get property of non-object in /in/RJ5au on line 54
Fatal error: Call to a member function paddleOut() on null in /in/RJ5au on line 54
Process exited with code 255.
Ahh, all waxed up with 'candleWax'. Ready to go!
Notice: Trying to get property of non-object in /in/RJ5au on line 54
Fatal error: Call to a member function paddleOut() on a non-object in /in/RJ5au on line 54
Process exited with code 255.
Fatal error: Declaration of RookieSurfer::rideWave() must be compatible with that of Surfer::rideWave() in /in/RJ5au 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/RJ5au on line 8
Process exited with code 255.