Created
August 16, 2014 07:44
-
-
Save JacobHsu/f816632a90116e37d56b to your computer and use it in GitHub Desktop.
#PHP :Overriding Parent Methods
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
<html> | |
<head> | |
<title>Override!</title> | |
</head> | |
<body> | |
<p> | |
<?php | |
class Vehicle { | |
public function honk() { | |
return "HONK HONK!"; | |
} | |
} | |
// Add your code below! | |
class Bicycle extends Vehicle { | |
// Your code here | |
public function honk() { | |
return "Beep beep!"; | |
} | |
} | |
$bicycle = new Bicycle(); | |
echo $bicycle -> honk(); | |
?> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment