Re: Property setter and getter in PHP5

From: Date: Sun, 20 Jul 2003 16:36:47 +0000
Subject: Re: Property setter and getter in PHP5
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-3517@lists.php.net to get a copy of this message
Hi Masoud, It's already available. See http://www.phppatterns.com/index.php/article/articleview/28/1/2/ "Masoud" <masoud@iranphp.net> wrote in message news:20030720155214.18238.qmail@pb1.pair.com... > It's just a suggestion to have a syntax like this in PHP5! > > A property is similar to a field (a member variable), with the exception > that there is a getter and a setter > method, as follows : > > public class Car > { > private string make; > public string Make > { > get { return make; } > set { make = value; } > } > } > > Car c = new Car( ); > c.Make = "Acura"; // use setter > String s = c.Make; // use getter > > above example is a simple C# example in NET Framework Essentials. > > > Masoud > >

« previous php.internals (#3517) next »