www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10699] New: override inconsistently allowed for abstract functions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10699

           Summary: override inconsistently allowed for abstract functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-07-22
18:33:22 PDT ---
-----
interface IC
{
    abstract void foo();

    abstract void bar();
}

class AC : IC
{
    override void foo() { }
}

class CC : AC
{
    override void bar() { }
}
-----

$ Error: function test.CC.bar does not override any function, did you mean to
override 'test.IC.bar'?

If we're allowed to use 'override' for implementing abstract methods in AC, why
is it not allowed in CC?

Also related: http://d.puremagic.com/issues/show_bug.cgi?id=9978

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 22 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10699



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-07-22
18:35:10 PDT ---
I want these to work because it makes it clearer from reading the class that
these methods can be called with a reference to a base class (and in fact the
base class can call such a method itself). Disallowing 'override' in this case
makes the code less clear.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 22 2013