Re: RE:Class::? - accessing data, no success...

From: Date: Tue, 04 Jul 2000 11:41:47 +0000
Subject: Re: RE:Class::? - accessing data, no success...
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-23447@lists.php.net to get a copy of this message
Stanislav Malyshev wrote: > > UW>> Please do not implement $class::var = $x. This would cause > UW>> confusion and it would not make any sense. Use objects to do such > UW>> things. > > How about f($class::var)? Sorry, there's a typo. "class::var = $x" is bad in my eyes. > > UW>> <?php > UW>> class foo { > UW>> var $bar = "this one is good"; > UW>> > UW>> function foo() { > UW>> print "silly example"; > UW>> } > UW>> } > UW>> > UW>> print foo::bar; // static (read-only!) access of a property > UW>> foo::foo(); // static access of a method > UW>> ?> > > $foo_bar = "this one is good"; > class foo { > function foo() { > print "silly example"; > } > } > > print $foo_bar; > > etc, etc. I know that there are several workarounds. But that's not the point! Why can I use "::" to do foo::foo() from outside any class in PHP to get someting very similar to a static method call ( PIKEs NameOfModule.Function(), C++ NameOfClass::Method() or Java's NameOfClass.Method() ) ? If I can use it outside any class, why not making foo::bar beeing a read-only access to class property ? Ulf -- Ulf Wendel NetUSE AG Siemenswall, D-24107 Kiel, Germany Fon: +49 431 386435 00 -- Fax: +49 431 386435 99

« previous php.dev (#23447) next »