Re: [PHP] Variables in PHP: public vs. private

2002-05-17 Thread hassan

HI,

as far as i know private vars should be available in the next release of 
the zend engine, thus, using get and set functions is a good practice to be 
sure that your apps will still function in future php releases.

Regrads.
___
Hassan El Forkani
Founder And Mantainer of :
http://WarmAfrica.com EveryOne's Africa
Freelance Internet Consultant / Web Applications Developper.
Email: [EMAIL PROTECTED]
Tel : 0021671880014
___



At 14:36 17/05/02, Christoph Starkmann wrote:
Hi there!

I'm just starting to get in touch with
oo programming in PHP. Now I've got a
quite simple question, I guess...

In an example in the PHP-help, I found
a class definition with accessor functions
like

dummy-get_some_variable();

But AFAIK (and see ;)), variables in PHP
in fact are never private, but always
public, at least within the current script.

So what would be the sense in having
this kind of functions? Readability?
Just a fake?

Or can I declare variables as private?
(this would be the best in my eyes, indeed)

Thanx alot,

Kiko

--
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.gruppe-69.com/
--

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

___
Hassan El Forkani
Founder And Mantainer of :
http://WarmAfrica.com EveryOne's Africa
Freelance Internet Consultant / Web Applications Developper.
Email: [EMAIL PROTECTED]
Tel : 0021671880014
___


Re: [PHP] Variables in PHP: public vs. private

2002-05-17 Thread Dan Hardiker

 But AFAIK (and see ;)), variables in PHP
 in fact are never private, but always
 public, at least within the current script.


This is correct, all functions and variables inside a class are public.
There are no protected nor private func's / var's.


 So what would be the sense in having
 this kind of functions? Readability?


1. Grouping similarly purposed functions together into one class makes
usability much better (also allows for polymorphism and suchforth)

2. Expandability... although PHP doesnt support protected functions and
variables, thats not to say it never will... and should the day come - it
would have to be backwardly compatable. This is at least seen as a step
in the right direction

3. Interitance (which is only really possible with classes in any usable
form) with the ability to call the parent's function or over-ride it with
your own.


PHP has never claimed to be fully OOP compliant infact it has quite
blatently stated that its not. I hope that the time will come when PHP
has much more OOP support like other languages (such as C++, delphi etc).


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software  Systems Engineer



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