How can I test at compile time whether T is an instance of an interface ?

wjoe invalid at example.com
Wed Sep 23 18:56:33 UTC 2020


On Wednesday, 23 September 2020 at 18:49:28 UTC, data pulverizer 
wrote:
> On Wednesday, 23 September 2020 at 18:37:45 UTC, wjoe wrote:
>> [...]
>
> A class at compile time is it's own static type, OOP 
> polymorphism is a runtime feature not compile time. You have to 
> write your own traits for specific objects to get them to 
> relate to each other using static overloading.

It doesn't occur to me that the compiler doesn't know at compile 
time that

interface IFoo{}
class Foo: IFoo {}

class Foo implements interface IFoo.



More information about the Digitalmars-d-learn mailing list