C# Indexers. how to implement them in D.. also property related.
Steven Schveighoffer
schveiguy at yahoo.com
Tue Jun 29 07:27:18 PDT 2010
On Tue, 29 Jun 2010 09:55:50 -0400, BLS <windevguy at hotmail.de> wrote:
> On 29/06/2010 15:35, BLS wrote:
>> On 29/06/2010 15:27, Steven Schveighoffer wrote:
>>> string opIndex(string columnName);
>>
>> yeah this is what I did, too..
>> However defined as ;
>>
>> interface I1 {
>> string opIndex(string columnName);
>> }
>>
>> is a no go. So can we say operator overloading within interfaces is not
>> allowed in D2 ?
>>
>> thanks again Steve.. try to learn the interface/property stuff.
>
> Jeez, my mistake.. forget to create the implementation. sorry!
LOL! :)
As others have said, templates do not yet work in interfaces, and there is
another subtle problem: templates in interfaces are not virtual so they
cannot enjoy covariance. This is a problem for dcollections which uses
operators in interfaces.
The only solution right now is to reimplement the template in the derived
classes.
Not a fun situation...
-Steve
More information about the Digitalmars-d-learn
mailing list