Last active
August 29, 2015 13:56
-
-
Save andrewwatson/8811569 to your computer and use it in GitHub Desktop.
Late Static Binding Question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A { | |
protected static function doStuff() { | |
return "Hello "; | |
} | |
} | |
class B extends A { | |
public function helloWorld() | |
{ | |
// Add one (1) line of code here that concatenates strings in order to | |
// output "Hello World!" using only the doStuff() functions | |
} | |
protected static function doStuff() { | |
return "world"; | |
} | |
} | |
class C extends B { | |
protected static function doStuff() { | |
return "!"; | |
} | |
} | |
$object = new C(); | |
echo $object->helloWorld(); | |
// Write helloWorld | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment