Extending an interface or class outside of it

Frustrated c1514843 at drdrb.com
Mon Nov 25 21:20:09 PST 2013


On Tuesday, 26 November 2013 at 05:12:00 UTC, Frustrated wrote:
> On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli wrote:
>> On 11/25/2013 04:27 PM, Frustrated wrote:
>>> I have some type of automatically generated interface using a 
>>> mixin an
>>> would like to extend them after they are generated:
>>>
>>>    mixin(GenerateMyInterface!(...));
>>>
>>>    ... <Here I would like to add some members/methods to 
>>> MyInterface
>>> which was generated above> ...
>>>
>>> Is this at all possible?
>>>
>>>
>>
>> Just inherit from it:
>>
>> interface MyInterface
>> {
>>    void foo();
>> }
>>
>> interface EvenMoreMyInterface : MyInterface
>> {
>>    void bar();
>> }
>>
>> Ali
>
> No, this is not the way. I am creating the interface and need 
> to add to it only because it is generated. If I inherit from it 
> then I would have to update all references that use the 
> interface to use the new one.

If it was not generated I could just easily add directly to the 
interface.


More information about the Digitalmars-d-learn mailing list