so you don't accidentally override a base class method without knowing it.
Trass3r:
> so you don't accidentally override a base class method without knowing it.
I'm trying to help D become tidier, I have added this days ago:
http://d.puremagic.com/issues/show_bug.cgi?id=3836
Bye,
bearophile
"Trass3r" wrote in message
news:op.u9i1zxqa3nc...@hoenir.fem.tu-ilmenau.de...
> so you don't accidentally override a base class method without knowing it.
I read about "override" when I first got into D way back before D1.0 and
thought it sounded great. Then I promptly forgot about it since the
"Nick Sabalausky" wrote in message
news:hnh4kl$1iq...@digitalmars.com...
> "Trass3r" wrote in message
> news:op.u9i1zxqa3nc...@hoenir.fem.tu-ilmenau.de...
>> so you don't accidentally override a base class method without knowing
>> it.
>
> I read about "override" when I first got into D way ba
On 2010-03-13 17:27:23 -0500, Trass3r said:
so you don't accidentally override a base class method without knowing it.
It's my opinion that it should.
(bugzilla 3836)++
--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/
On 03/13/2010 04:27 PM, Trass3r wrote:
so you don't accidentally override a base class method without knowing it.
It is in TDPL so it is in the language :o).
Andrei
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Trass3r wrote:
> so you don't accidentally override a base class method without knowing it.
use -w:
import std.stdio;
class A
{
void foo() { writeln("A.foo"); }
}
class B : A
{
void foo() { writeln("B.foo"); }
}
void main()
{
A a = new
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 forc
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Jonathan M Davis wrote:
> 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
True, but using override clearly documents what you doing in that class.
Otherwise you have to arse about looking through the interfaces to see
if an unmarked function is an implementation, which is the same end
result as unmarked overrides.
I vote for requiring override in all cases; I think it
div0 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Jonathan M Davis wrote:
>> 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 markin
11 matches
Mail list logo