[Issue 559] New: Final has no effect on methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 18 07:30:37 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=559

           Summary: Final has no effect on methods
           Product: D
           Version: 0.174
          Platform: PC
               URL: http://www.digitalmars.com/d/function.html
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: deewiant at gmail.com


class Base {
        final void foo() {}
}

class Derived : Base {
        void foo() {}
}

This compiles fine, although "Functions marked as final may not be overridden
in a derived class".

Changing Derived.foo to override void foo() {} makes DMD bark:

asdf.d(7): function asdf.Derived.foo function foo does not override any

With or without override, DMD should say "function asdf.Derived.foo cannot
override final function asdf.Base.foo" or something to that effect.


-- 




More information about the Digitalmars-d-bugs mailing list