Interfaces allow member definitions?

Steven Schveighoffer schveiguy at yahoo.com
Thu Jan 30 07:28:24 PST 2014


On Thu, 30 Jan 2014 09:31:05 -0500, Frustrated <c1514843 at drdrb.com> wrote:


> I'm not asking about a work around but if what I am talking about
> can actually be done(does the vtable support this or can made to
> support it?)

Yes. Interfaces have no concrete vtable. Only classes do. A concrete class  
can decide what the vtable has in it, and if you had a "default"  
implementation, the compiler could stick that in there. Note that the  
default implementation only can call other member functions within the  
interface or module-level functions, interfaces cannot access any derived  
data or members.

Whether such a change would be accepted? No clue.

-Steve


More information about the Digitalmars-d-learn mailing list