Date: 12/29/00
- Next message: Richard Lynch: "Re: [PHP] Original problem?"
- Previous message: Richard Lynch: "Re: [PHP] getting info from a remote http server"
- In reply to: Jeroen Olthof: "[PHP] private variable in object ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> hi, I'm used programming OO in java.
> the variable in a class could be private. only instance of te same classe
> can directly access those variable. all other have to use functions
> like
> name = someObject.getName()
>
> I'd like to know if php uses (or is able to use) this structure because in
> this way the programmer got more control over all the things that happens
in
> a object.
Not at this time.
You can "fake it" by writing something not unlike this:
function private_foo($set = ''){
static $foo;
if (isset($set)){
$foo = $set;
}
return $foo;
}
class bar{
function bar(){
private_foo();
}
function set_bar($new_value){
private_foo($new_value);
}
}
Now, bar() essentially behaves like a private $bar variable.
Disclaimer: I don't use PHP OO.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Richard Lynch: "Re: [PHP] Original problem?"
- Previous message: Richard Lynch: "Re: [PHP] getting info from a remote http server"
- In reply to: Jeroen Olthof: "[PHP] private variable in object ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

