Re: private $foo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/28/06, Jay Blanchard <jblanchard@xxxxxxxxxx> wrote:
> [snip]
> I see this all over the place, but I don't think it stores the variable
> in =
> $foo:
>
> class Foo {
> private $foo;
>
> public function __setFoo($arg)
> {
>   $this->foo = $arg;
> }
> [/snip]
>
> I am always using 'foo' in conversation and finally said it enough that
> the CEO used it in a meeting the other day. Setter functions are cool.
>
>

Nevermind, it does need private $foo; it works without it, but not if
you want to use a default from within the class.

if you set private $foo = 'foo';

print $f->__getFoo();
$f->__setFoo('bar');
print $f->__getFoo();

Yields:
foo
bar


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux