note 56224 added to language.oop5
| From: | madcoder_jm at hotmail dot com | Date: | Sat, 27 Aug 2005 19:32:06 +0000 |
| Subject: | note 56224 added to language.oop5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94269@lists.php.net to get a copy of this message | ||
I'm a newbie to php but i have some c++ programming experience so i'm okay with classes.
I'm trying to get a class to instantiate and use echo to output the value of the class members,
however the browser always outputs a blank page.
Here's the code:
class Human{
private $arms;
private $legs;
private $eyes;
public function setArms($num)
{
if($num<=2 && $num>0)$this->arms=$num;
}
public function setLegs($num){
if($num<=2 && $num>0)$this->legs=$num;
}
public function setEyes($num)
{
if($num<=2 && $num>0)$this->eyes=$num;
}
public function getArms()
{
$this->arms;
}
public function getLegs(){
return $this->legs;
}
public function getEyes()
{
return this->eyes;
}
public function _construct()
{
$this->eyes=2;
$this->arms=2;
$this->legs=2;
}
}//End of class
Can anyone help?!!!!
----
Manual Page -- http://www.php.net/manual/en/language.oop5.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56224
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56224&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56224&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56224&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56224&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56224&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56224&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56224&report=yes
Search -- http://master.php.net/manage/user-notes.php