[Issue 559] Final has no effect on methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 3 03:03:09 PST 2006


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


deewiant at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |511
              nThis|                            |
           Keywords|                            |spec




------- Comment #2 from deewiant at gmail.com  2006-12-03 05:03 -------
It is against the spec. See http://www.digitalmars.com/d/function.html, under
"Virtual Functions": "Functions marked as final may not be overridden in a
derived class, unless they are also private. For example:"

class A
{
    int def() { ... }
    final int foo() { ... }
    final private int bar() { ... }
    private int abc() { ... }
}
class B : A
{
    int def() { ... }   // ok, overrides A.def
    int foo() { ... }   // error, A.foo is final
    int bar() { ... }   // ok, A.bar is final private, but not virtual
    int abc() { ... }   // ok, A.abc is not virtual, B.abc is virtual
}

The relevant bit is the comment "error, A.foo is final". This code compiles
without a problem, yet according to the spec it shouldn't.


-- 




More information about the Digitalmars-d-bugs mailing list