real private object variables?

From: Date: Fri, 25 Feb 2000 16:06:24 +0000
Subject: real private object variables?
Groups: php.version4 
Request: Send a blank email to php-version4+get-10967@lists.php.net to get a copy of this message
> > BTW: what about not serializing class variables that start > > with a '_' character. the usage should be obvious, right? > Nope, sorry. I (and others) use _ as means of denoting private > variables. BTW: are there any plans for real private variables? class foo { var $bar = 'a public value'; var $_bar = 'a private value'; function print_private_bar() { print $this->_bar; } } $f = new foo; echo $f->bar; # prints 'a public value' echo $f->_bar; # prints nothing (maybe a warning) $f->print_private_bar(); # prints 'a private value' get_class_vars() would only return $bar, etc.. -Jade.

« previous php.version4 (#10967) next »