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:[EMAIL PROTECTED]
Sent: 29 April 2008 17:14
To: John Carter -X (johncart - PolicyApp Ltd at Cisco)
Cc: [email protected]
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) <[EMAIL PROTECTED]> 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