JacobHsu
8/16/2014 - 7:44 AM

#PHP :Overriding Parent Methods

#PHP :Overriding Parent Methods

<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>