as Chris W. Parker noticed, there is a little mistake in the example above
posted by me, it says:

//Class function
function set() {
    $sum = $this->a . $this->b . $this->c;
}

and it should say:

//Class function
function set() {
    $this->sum = $this->a . $this->b . $this->c;
}

sorry :P
luis.

"Luis Mirabal" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> when you are working with classes and objects in php, and you are coding
> inside a class, you must use the $this variable to access the members of
the
> class, for example:
>
> class test {
>
>     //Class vars (something like properties)
>     var $a;
>     var $b;
>     var $c;
>     var $sum;
>
>     //Class function (Constructor)
>     function test() {
>         $this->a = 'value for a';
>         $this->b = 'value for b';
>         $this->c = 'value for c';
>         $this->set();
>     }
>
>     //Class function
>     function set() {
>         $sum = $this->a . $this->b . $this->c;
>     }
>
> } //end class
>
> luis.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to