digitalmars.D - the override keyword
- Frank Benoit (13/13) Nov 04 2007 Can we make the override keyword also be needed for implementing an
- Stewart Gordon (16/25) Nov 05 2007 I'm not sure about this. If the base class and an implemented interface...
Can we make the override keyword also be needed for implementing an interface function. This is not exactly overriding, but the purpose is the same. I want to write the keyword to say "Mr Compiler, check the override/implementing rules for a definition in the superclass or an interface! If the sig doens't match one, give error.". Another feature request here is: The message "cannot instanciate abstract class XYZ..." is not so helpful. Please give a tip, of at least one missing implementation. I had several times the case where I needed to search a hierarchy for long time to find out why a class is abstract. This is kind of more complicated with D2 where a const thing changes the signature and override is also needed.
Nov 04 2007
"Frank Benoit" <keinfarbton googlemail.com> wrote in message news:fglj0h$8np$1 digitalmars.com...Can we make the override keyword also be needed for implementing an interface function. This is not exactly overriding, but the purpose is the same. I want to write the keyword to say "Mr Compiler, check the override/implementing rules for a definition in the superclass or an interface! If the sig doens't match one, give error.".I'm not sure about this. If the base class and an implemented interface both have methods with the same name but different signatures, it could lead to a situation where you intended to override a method from the base class, and used the override keyword to try to check for this, but ended up implementing an interface method instead. Or vice versa.Another feature request here is: The message "cannot instanciate abstract class XYZ..." is not so helpful. Please give a tip, of at least one missing implementation.<snip> Been proposed several times. http://d.puremagic.com/issues/show_bug.cgi?id=204 Though personally, I'd like a requirement that abstract classes be declared with the abstract keyword like in Java. Stewart. -- My e-mail address is valid but not my primary mailbox. Please keep replies on the 'group where everybody may benefit.
Nov 05 2007