www.digitalmars.com         C & C++   DMDScript  

D - override ???

reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Here I am again :)

This time it's stream.d, line 294.  What is:

class ...
{
    ...
    override uint readBlock(...) {...}
}

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Apr 12 2002
parent "Pavel Minayev" <evilone omen.ru> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3CB71F09.3AC0DDFB deming-os.org...

 Here I am again :)

 This time it's stream.d, line 294.  What is:

 class ...
 {
     ...
     override uint readBlock(...) {...}
 }
"override" tells the compiler that we don't want to define a new function, but rather override an existing one. Thus, if no function with the same name exists in the base class, compiler breaks with an error. It comes very handy if you have the habit of changing function names in base classes: using "override", you are guaranteed to be warned of any potentially unsafe situation.
Apr 12 2002