Interfaces allow member definitions?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jan 30 09:11:24 PST 2014
On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated <c1514843 at drdrb.com> wrote:
> Essentially what it boils down to is treating interfaces like
> classes that have no fields). To avoid the diamond problem simply
> always choose the method that is not from the interface(since it
> is "default"), which is done naturally with the vtable.
It's simpler than that. A function is a block of code. A vtable entry
points to a block of code. Just point the vtable entry at the block of
code that is the default implementation.
-Steve
More information about the Digitalmars-d-learn
mailing list