EvilZone
Programming and Scripting => Web Oriented Coding => : gh0st October 27, 2013, 05:52:00 AM
-
<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{
public function honk(){
return "Beep beep!";
}
}
$bicycle = new Bicycle();
$bicycle -> honk();
?>
</p>
</body>
</html>
i need to get an echo of something but the error keeps saying me that I just print : " ....... lol help :'(
http://www.codecademy.com/courses/web-beginner-en-bH5s3/0/4?curriculum_id=5124ef4c78d510dd89003eb8 (http://www.codecademy.com/courses/web-beginner-en-bH5s3/0/4?curriculum_id=5124ef4c78d510dd89003eb8)
Staff note: Please use the code tags in the future. I have added them this time.
-
Yeah, you're not actually echoing anything.
Line 21 should be:
echo $bicycle->honk();
-
(http://i3.kym-cdn.com/photos/images/original/000/234/765/b7e.jpg)
thanks mate
-
You are returning a value, not printing it out.
So, your code should be like this :
$bicycle = new Bicycle();
$output = $bicycle->honk();
echo $output;