www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9978] New: Can override interface function

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

           Summary: Can override interface function
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: damianday hotmail.co.uk



interface I
{
    void foo();
}

class A : I
{
    public override void foo() { } // OK, but should be NG!!
    public void foo() { } // OK
}

In this example the use of override is optional,
however since we are not overriding any function it should
be illegal to specify it as override.

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




10:22:51 PDT ---
I would tend to think this is allowed.  Imagine if you switched an interface to
an abstract base class or vice versa, you wish to make someone go through all
their calls and add/remove override?

I had a bug fixed a long time ago, issue 2524.

In a comment, Walter said:

"This is a compiler bug. You can override an interface function."

I'm assuming this still applies today.

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





 I would tend to think this is allowed.  Imagine if you switched an interface to
 an abstract base class or vice versa, you wish to make someone go through all
 their calls and add/remove override?
 
 I had a bug fixed a long time ago, issue 2524.
 
 In a comment, Walter said:
 
 "This is a compiler bug. You can override an interface function."
 
 I'm assuming this still applies today.
That's precisely what I was doing when I stumbled upon this, changing a abstract class to a interface. I'm not sure why both are allowed, even though it does no harm to keep both, it seems one should be the right way and the other a warning possibly? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013