This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Objects in PHP Forum

View Course » View Exercise

302 points
542c8d52d3584b87db2007147ce07dcc?s=140&d=retro
Submitted by
TTT22
about 2 years ago

overriding parent methods

oo PHP 4/8?


0 votes

permalink

Hi! Try to copy and paste your code so that we can help you.

1296 points
55c8a46fd3292f16e7000358_188723933
Submitted by
Raphael Andreolli
almost 2 years ago


0 votes

permalink

Override!



<?php
class Vehicle {
final public function honk() {
return "HONK HONK!";
}
}
// Add your code below!
class Bicycle extends Vehicle {
public function "Beep beep!";
}
}
$bicycle = new Bicycle();
echo $bicycle->honk();

?>


302 points
542c8d52d3584b87db2007147ce07dcc?s=140&d=retro
Submitted by
TTT22
almost 2 years ago


0 votes

permalink

Oops, try again. Did you use the public method honk() ... syntax inside the Bicycle class to override the original honk method? This is the error message.

302 points
542c8d52d3584b87db2007147ce07dcc?s=140&d=retro
Submitted by
TTT22
almost 2 years ago