Posted by Colin McKinnon on 01/13/07 00:36
Schmidty wrote:
> Fairly new to OOP and PHP5.
<snip>
>
> Example ==========================================================
>
> class NAME {
> public $name;
> public $unknown;
> public $value;
>
>
> function __construct($value) {
> $this->setName($this->value);
no - I guess you want to assign the value in the parameter using the setName
method...
$this->setName($value);
> }
>
> function setName($value) {
> $this->name = $value;
Yup - just like that
> }
>
> function getName() {
> return $this->name;
> }
>
> function nameKid($unknown) {
> $this->setName($unkown);
erm, not sure what this is trying to (even without the typo).
Looks like your nearly there.
HTH
C.
[Back to original message]
|