Re: Accessing child constants from base class

From: Date: Sat, 11 Oct 2003 14:25:39 +0000
Subject: Re: Accessing child constants from base class
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-4800@lists.php.net to get a copy of this message
Hello Dan, Friday, October 10, 2003, 7:37:29 PM, you wrote: > Hi Marcus- > Marcus Börger wrote: >>Constants are bound to the class rather then to the objects. Hence they >>behave pretty much like static properties or default values of declared >>properties and like the latter they are read only. >> >> > understood. >>The only question here is whether we want to be able to access static >>and/or const class members through something dynamically like $this at >>runtime. Everything else is perfectly correct in place. >> >>And of course constants are public. So perhaps you might want to be able >>to apply visibility to constants, too? If so i must dissappoint you with >>the fact that it is currently impossible to do that and the amount of work >>to enable this seems so high that it is unlike to happen. >> >> >> > So, in order to access class constants from outside the class, the > class itself must be static? Obviously (I thought for backwards > compatability only) all classes are static in PHP5, but looking toward > the future, will we continue to have all classes always statically > accessible? The class definition is a static thing but several things can only be accessed from instantiated objects. That is a non static method and non static properties can only be accessed via objects. What else should happen? Non static members are instance bound not class bound. -- Best regards, Marcus mailto:helly@php.net

« previous php.internals (#4800) next »