Re: inheritance bug?
Jason Thomas <[email protected]>
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
What about doing #2 but allowing an optional override keyword if you want the compiler to check your spelling? Thanks for the help! -Jason On Tue, 2004-02-17 at 04:46, Daniel Bonniot wrote: > [email protected] wrote: > > >This was discussed on the mailing list in the covariant return type thread, I > >believe. When you specify a return type, you are overloading the method. In > >order to _override_ the method, you need to leave the return type off. > > > > > Right. > > Once again we can see the confusion this creates. I think it this case > it should either: > > 1) signal an error because you are overloading a method in a more > specific case. You could then explicitely state that you override it > with the 'override' keyword (especially if you want to covariantly > specialize the return type) or simply delete the return type. > > 2) silently override the initial method. This is Java's behaviour. So > that's more intuitive to Java developers, and ligther syntax (but only > when you need to specialize the return type, which is probably rare). On > the other hand, it bears the risk of silently not overriding if you make > a typo in the method's name, and hides the fact to the reader that you > are actually overriding a method. > > Daniel > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Nice-info mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nice-info > -- Jason Thomas The Electric Mind, Ltd. http://www.theelectricmind.com/ ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click