You are here: Re: php 5 classes: public, protected and private « PHP Programming Language « IT news, forums, messages
Re: php 5 classes: public, protected and private

Posted by Curtis on 12/04/06 09:03

> Hi, Curtis,

Hello :)

<snip>
> If these variables are public, you can never change them. But what
> happens if you need to - i.e. for performance? Or accuracy?
<snip>
> Rather, if you encapsulate the longitude and latitude, making them
> private, with accessor functions, the data is not hidden - but the
> implementation is.

I see, I see. All of a sudden, it's like a light bulb turned on in my
head. I have have experience using OOP in PHP, Perl, JavaScript, and
very little in Python and C++, but I am nowhere near an expert,
although I have learned a lot from just trying out code and reading
documentation. There is a lot to OOP I have yet to learn, so I'll try
getting the materials by the experts mentioned. ;)

Just to make sure I interpreted your post correctly:

The benefit of encapsulation is doing things like making certain class
members private, and then utilizing setters/getters so that you can be
much more flexible in changing your class in the future.

 

Navigation:

[Reply to this 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

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