I don't even know if this is a bug or a feature of language. I will just put it here.

interface ITaskDoer
{
        int doTask1();
        string doTask2(string someName);
        
        bool doTask3(bool value);
        
}

abstract //Do abstract makes interface methods abstract?
class BaseTaskDoer: ITaskDoer
{
        override string doTask2(string someName)
        {       return "You have passed name: \"" ~ someName ~ "\"";
        }
        
        //Uncommenting this makes code working,
        //but this is not much pretty looking code
        //override {
        //      abstract int doTask1();
        //      abstract bool doTask3(bool value);
        //}
}

class TaskDoer: BaseTaskDoer
{
        override int doTask1()
        {       return 100; }
        
        override bool doTask3(bool value)
        {       return !value; }
        
}

void main()
{       import std.stdio;
        auto doer = new TaskDoer;
writeln(doer.doTask1()," ",doer.doTask2("John")," ",doer.doTask3(true));
        
}

Compilation output:
/d124/f170.d(27): Error: function f170.TaskDoer.doTask1 does not override any function, did you mean to override 'f170.ITaskDoer.doTask1'? /d124/f170.d(30): Error: function f170.TaskDoer.doTask3 does not override any function, did you mean to override 'f170.ITaskDoer.doTask3'?

Please tell me the right way deal with this case? Is it a bug or not?

Reply via email to