Interfaces and templates

JN 666total at wp.pl
Fri Sep 20 19:02:11 UTC 2019


import std.stdio;

interface IWriter
{
     void write(U)(U x);
}

class Foo : IWriter
{
     void write(U)(U x, int y)
     {
         writeln(x);
     }
}



void main()
{
}

Does this code make sense? If so, why doesn't it throw an error 
about unimplemented write (or incorrectly implemented) method?


More information about the Digitalmars-d-learn mailing list