Weird combo of static function, templates, interfaces (that doesn't link)

0xEAB desisma at heidel.beer
Wed Jan 2 17:24:22 UTC 2019


On Sunday, 30 December 2018 at 18:55:10 UTC, Ali Çehreli wrote:
> On 12/30/2018 05:05 AM, 0xEAB wrote:
>
> >> interface FooAdapter
> >> {
> >>     FooBundle!(Handle) createSome(Handle)();
> >> }
>
> Function templates cannot be virtual functions. One reason is 
> the compiler cannot know how large the virtual function table 
> should be, and the other one is it's just a template, not the 
> real thing (i.e. not a function).
>
> >> private class SomeAdapter : FooAdapter
> >> {
> >>     Bundle createSome()
>
> SomeAdapter.createSome is a function unrelated to 
> FooAdapter.createSome. Their only relationship is through "name 
> hiding."
>
> > - Does `SomeAdapter` even implement `FooAdapter` correctly?
>
> Yes because FooAdapter has no virtual function. :p
>
> >   ~ Elias
>
> Ali

Thanks for the technical explanation.
   ~ Elias


More information about the Digitalmars-d-learn mailing list