On Mon, 15 May 2006 00:01:02 -0700, kh <kh@newsgroups.nospam> wrote:
Perhaps I've misunderstood your question, but is this not something that can
be achieved with a property defined on the interface with only a getter (i.e.
a read-only property)? Obviously you cannot define values within the
interface definition, but in this way you can require your implementors to
supply one...
I was thinking of simple constants. For instance, if an interface had
a function: PaintBackgroundPurple(), it would make sense to have a
defined Purple that could travel with the interface. In other words,
the implementation of how to paint the background would be variable,
but you don't want the particular shade of Purple to vary. Everyone
that implements the interface would use the same Purple.
In that sense, it would be nice to have tighter coupling between the
Interface and the defined colors that it is using.
This may not be the perfect example, but I do run into variants on the
scenario once in a while.
I understand that allowing constants within the Interface could result
in diamond inheritance, with multiple Purple defines converging when
multiple interfaces are inherited, but I was wondering if there is
another way to implement this.