Hey Everyone!
So I am fairly versed with PHP applications but I am rather new to OOP with PHP. I am getting the following error: Fatal error: Fatal error: Call to undefined function: gear_up()
Sure this is just some sticky syntax. Here's my object code:
PHP Code:
include ("class.bike.php"); $bike = new Bike(); $this->gear = gear_up(); $this->color = change_color("Blue"); $this->cadence = speed_up(); echo $bike->cadence . "<br>"; echo $bike->gear . "<br>"; echo $bike->color;
I'm guessing the problem must lie within my class constructor which looks like this:
PHP Code:
class Bike { var $cadence = 0; var $gear = 1; var $color = "Red"; function Bike() { } function slow_down(){ if ($this->cadence > 0){ $this->cadence--; } else{ echo ("You are already stopped"); } } function speed_up(){ $this->cadence++; } function gear_up(){ $this->gear++; } function gear_down(){ $this->gear--; } function change_color($new_color){ $this->color = $new_color; } }
What am I forgetting?
Thanks a lot!
-Nick
|