shouldn't override be obligatory?
Jonathan M Davis
jmdavisProg at gmail.com
Sun Mar 14 13:06:54 PDT 2010
div0 wrote:
> Strangely it doesn't give an error if A is an interface though.
Interfaces aren't overridden; they're implemented. You're providing
functionality, not replacing it. By marking a function with override, you're
clearly marking that it's polymorphic and intended to be so. If you force
override for all cases when a function is overridden, then you avoid issues
where you unknowingly override a function, changing the objects behavior.
That's not a problem with interfaces since there's no behavior to change.
The problem with interfaces is when you don't implement them completely, and
they complain plenty when that happens.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list