Is Override Still Mandatory?

Jonathan M Davis jmdavisProg at gmx.com
Sun Nov 11 19:08:11 PST 2012


On Monday, November 12, 2012 03:58:17 Vijay Nayar wrote:
> I was under the impression that the attribute "override" was
> mandatory when replacing a virtual function in a base class.
> However, code that leaves this out has no errors using dmd v2.060.
 
It's mandatory if you compile with -w. Eventually, it will be mandatory all 
the time. It's just that it's being phased in via -w rather than requiring it 
immediately. That way, people have time to fix their code to use it before it's 
required. Unfortunately though, a lot of people fail to compile with either -w 
or -wi, so they're happily writing _new_ code which will break once override 
is always required, which means that phasing like this doesn't necessarily 
actually fix the problem.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list