Author Topic: what im doing wrong?  (Read 1190 times)

0 Members and 1 Guest are viewing this topic.

Offline gh0st

  • Sir
  • ***
  • Posts: 575
  • Cookies: 8
  • #DEDSec
    • View Profile
what im doing wrong?
« on: October 27, 2013, 05:52:00 am »
Code: (php) [Select]
<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

Staff note: Please use the code tags in the future. I have added them this time.
« Last Edit: October 27, 2013, 06:02:37 am by techb »

Offline Fur

  • Knight
  • **
  • Posts: 216
  • Cookies: 34
    • View Profile
Re: what im doing wrong?
« Reply #1 on: October 27, 2013, 06:45:14 am »
Yeah, you're not actually echoing anything.

Line 21 should be:
Code: (PHP) [Select]
echo $bicycle->honk();
« Last Edit: October 27, 2013, 06:45:57 am by Fur »

Offline gh0st

  • Sir
  • ***
  • Posts: 575
  • Cookies: 8
  • #DEDSec
    • View Profile
Re: what im doing wrong?
« Reply #2 on: October 27, 2013, 06:47:55 am »

 thanks mate
« Last Edit: October 27, 2013, 06:48:29 am by gh0st »

Offline The Alchemist

  • Peasant
  • *
  • Posts: 100
  • Cookies: 18
  • Cult Of Personality
    • View Profile
    • Scriptings - Paste Tool
Re: what im doing wrong?
« Reply #3 on: October 27, 2013, 07:01:47 am »
You are returning a value, not printing it out.
So, your code should be like this :
Code: (php) [Select]
$bicycle = new Bicycle();
$output = $bicycle->honk();
echo $output;
Defeat the best... To be the best...