RE: Re: [PHP-DEV] Class Properties in Interfaces?

From: Date: Tue, 29 Apr 2008 16:28:59 +0000
Subject: RE: Re: [PHP-DEV] Class Properties in Interfaces?
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-37309@lists.php.net to get a copy of this message
Nathan, By example: interface EggLayer { public $eggsLaid; } class Chicken implements EggLayer; Some would say (and maybe I would too) that you should have a getEggsLaid() method, that's fair enough. But why not the above? You say interfaces can't have properties because they require instance variables. Why do they require instance variables? I also think for the purposes of this discussion, property and instance variable mean the same thing. John. ________________________________ From: Nathan Nobbe [mailto:quickshiftin@gmail.com] Sent: 29 April 2008 17:14 To: John Carter -X (johncart - PolicyApp Ltd at Cisco) Cc: internals@lists.php.net Subject: Re: Re: [PHP-DEV] Class Properties in Interfaces? On Tue, Apr 29, 2008 at 9:51 AM, John Carter -X (johncart - PolicyApp Ltd at Cisco) <johncart@cisco.com> wrote: The article explicitly mentions OOP interfaces in a few languages. my bad. But the article, or for that matter any formal definition of an interface isn't really what I asked about: My question was simply: why can't interfaces have properties? when you say properties, do you mean a particular set of methods map to a particular instance variable, as getters and setters (i saw that definition from Sebastian earlier)? if thats the case than interfaces cant have properties because they require instance variables. -nathan

« previous php.internals (#37309) next »