Re: private, protected, readonly, public

From: Date: Fri, 12 May 2006 17:32:57 +0000
Subject: Re: private, protected, readonly, public
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Bastian Grupe wrote:
Uhh... how about using private and only using a "regular" getter (the Java-style) and no setter? class xx {
      private $bar;
      public getBar() { return $bar; }
}
i think you're missing the point, the idea is to *not* have to write that extra getter line ... less typing *and* less error prone ... and easier to read, too IMHO You didn't want to return $bar in your example, you wanted to return $this->bar so you already ran into one of the issues here ;) -- Hartmut Holzgraefe, Senior Support Engineer . MySQL AB, www.mysql.com Are you certified? http://www.mysql.com/training/certification

Thread (92 messages)

« previous php.internals (#23313) next »