TDPL 6.4.3 Overriding Is Only Voluntary

Jonathan M Davis jmdavisProg at gmx.com
Tue Mar 22 18:17:26 PDT 2011


> "The override keyword in the signature of Friend.bgColor is required,"
> (193)
> 
> This code compiles:
> 
> class Contact{ string bgColor(){ return ""; } }
> class Friend : Contact{
>     string bgColor(){ return "LightGreen"; }
> }
> 
> So how is 'override' required?  Can I get an example of where
> 'override' makes a difference?

dmd is behind TDPL on several counts. This is one of them ( 
http://d.puremagic.com/issues/show_bug.cgi?id=3836 ). Eventually, override 
_will_ be required. Right now, it's only required when compiling with -w.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list