
September 29th, 2007, 02:31 AM
|
| Administrator
Join Date: Jun 2007
Posts: 3,709
BRL$: 42,935.40 Thanks: 0
Thanked 14 Times in 10 Posts
Rep Power: 409 | | Fatal error: Call to undefined function: gear_up() 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:--------- include ("class.bike.php"); $bike = new Bike();$this->gear = gear_up();$this->color = change_color("Blue");$this->cadence = speed_up();echo $bike->cadence . "
";echo $bike->gear . "
";echo $bike->color;--------- I'm guessing the problem must lie within my class constructor which looks like this:PHP:---------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 To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. | |
__________________ █ High Quality To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
█ Powerful To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
█ To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts. █ Jobs In !!! - Post Jobs, Hire Employees, Create Blogs and
Earn Money. | | | |