oro Posted January 24, 2013 Report Share Posted January 24, 2013 I downloaded the two files from the site : index.php and class_lib.php and executed them . i was getting this error : Stefan's full name: Stefan Mischook Notice: Use of undefined constant name - assumed 'name' in /home/andy/Documenten/ServerRoot/class_lib.php on line 31 ---> JOHNNY FINGERS someone ? Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 24, 2013 Report Share Posted January 24, 2013 That likely means that there is a "$" missing before a variable name on line 31. Take a look at that, or post the code from class_lib.php and we can take a look. Quote Link to comment Share on other sites More sharing options...
oro Posted January 25, 2013 Author Report Share Posted January 25, 2013 That likely means that there is a "$" missing before a variable name on line 31. Take a look at that, or post the code from class_lib.php and we can take a look. line 31 is in bold , is suppose it has to be $this->name ? class person { // explicitly adding class properties are optional - but is good practice var $name; function __construct($persons_name) { $this->name = $persons_name; } public function get_name() { return $this->name; } //protected methods and properties restrict access to those elements. protected function set_name($new_name) { if (name != "Jimmy Two Guns") { $this->name = strtoupper($new_name); } } } // 'extends' is the keyword that enables inheritance class employee extends person { protected function set_name($new_name) { if ($new_name == "Stefan Sucks") { $this->name = $new_name; } else if($new_name == "Johnny Fingers") { parent::set_name($new_name); } } function __construct($employee_name) { $this->set_name($employee_name); } }v Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 25, 2013 Report Share Posted January 25, 2013 in that case, I think "name" is supposed to be "$new_name". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.