Reply to Re: php 5 classes: public, protected and private

Your name:

Reply:


Posted by Jerry Stuckle on 11/27/06 15:28

jopperdepopper wrote:
> Hi,
>
> finally giving php 5 a go, and going over the new approach to classes.
> Can someone clarify the public, private and protected to me?
>
> I quote the php manual: "The visibility of a property or method can be
> defined by prefixing the declaration with the keywords: public,
> protected or private. Public declared items can be accessed
> everywhere."
>
> But should I read "...can be accessed everywhere within a given class."
> or "...can be accessed by all other classes." ?
>
> Job
>

Job,

You should read "can be accessed everywhere".

Private members can be accessed by members of the class only.
Protected members can be accessed by members of the class or a derived
class.
Public members can be accessed by anyone, including other classes,
functions and any other code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация