Summary: obligatory override attribute
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2010-02-18 13:15:09 PST ---
override attribute is better to become obligatory (even when no -w is used) as
in C#, to avoid mistakes like this:

import std.stdio;

class Dog {
    public static void bark() {
        writeln("woof ");

class Basenji : Dog {
    public static void bark() {}

void main() {
    Dog woofer = new Dog();
    Dog nipper = new Basenji();

If the programmer knows that override is present if and only if a method
override another one, then this code can't be ambiguous.

(I think in C++ the obligatory override attribute is less necessary because
methods are not virtual by default, so only if you add an explicit "virtual" a
method can be overriden).

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to