[dmd-beta] D2 2.058 beta
Sönke Ludwig
ludwig at informatik.uni-luebeck.de
Thu Feb 9 06:24:13 PST 2012
>>________________________________
>> From: Sönke Ludwig <ludwig at informatik.uni-luebeck.de>
>>
>>Am 09.02.2012 09:16, schrieb Walter Bright:
>>> http://ftp.digitalmars.com/dmd2beta.zip
>>> _______________________________________________
>>> dmd-beta mailing list
>>> dmd-beta at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>
>>The deprecation of base class protection seems to have overshot its goal
>> a bit - implemented _interfaces_ are now also not allowed to be prefixed
>> with a protection attribute, although this can make perfect sense.
>
> Right, an interface is a public desription of what a class can do. I
> can't see any valid use case for private or protected interfaces.
>
> -Steve
>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
Artificial example (I have a different use case, but the pronciple is
similar):
interface ILinkedListItem {
LinkedListItem next();
void next(LinkedListItem v);
}
LinkedList objectStore;
class C : protected ILinkedListItem {
this()
{
objectStore.add(this);
}
protected LinkedListItem next() {...}
protected void next(LinkedListItem v) {...}
}
So the intent is that you don't have access to these methods from the
outside, but that C can still implement the interface to pass it only to
certain receivers (the objectStore list in this case).
More information about the dmd-beta
mailing list