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

Ali Çehreli acehreli at yahoo.com
Sun Dec 30 18:55:10 UTC 2018


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



More information about the Digitalmars-d-learn mailing list