Skip to content

Instantly share code, notes, and snippets.

@andrewwatson
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewwatson/8811569 to your computer and use it in GitHub Desktop.
Save andrewwatson/8811569 to your computer and use it in GitHub Desktop.
Late Static Binding Question
<?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