[dmd-beta] D2 2.058 beta
Walter Bright
walter at digitalmars.com
Thu Feb 9 08:29:40 PST 2012
On 2/9/2012 6:24 AM, Sönke Ludwig wrote:
> 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).
>
Wouldn't making ILinkedListItem private do the same thing?
More information about the dmd-beta
mailing list