Re: Questions about overloading and visibility in PHP5

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

 



On Tuesday 18 September 2007, Andrew Ballard wrote:

> > I'm guessing that the answer to all of my questions is some how
> > wrapped up in visibility and overloading.  Unfortunately I cannot find
> > any resource that documents the interactions.  TIA.
>
> As I understand it, the __get and __set do not ignore visibility;
> rather, they only work for accessing private members. If a property is
> declared public, it does not need the __get and __set, so they aren't
> used. Likewise, $bar->y is public since it was added dynamically
> outside the class.
>
> Andrew

Untrue.  If a property exists, then it is used as-is and 
__get()/__set()/__isset()/__unset() are never called.  The property behaves 
normally, as if those methods were not defined.  If they're not defined, the 
magic methods do whatever they do, which can include adding more properties 
to the object if appropriate (thus bypassing the magic methods in the 
future).

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
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