Re: inheritance bug?
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Quoting Jason Thomas <[email protected]>: > package test; > public class Test extends TestBase { > public void hello() { > println("hello nice"); > } > } try omitting the return type: public class Test extends TestBase { hello() { println("hello nice"); } } 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. - Brian > > When I run TestBase.java I get "hello java". When I run Test.nice I > get "hello nice". I was expecting to see "hello nice" in both cases. > So it seems that my Nice class isn't over-riding the hello method as > far as Java is concerned. Am I doing something wrong here? > > Thanks! > Jason > > > > ------------------------------------------------------- > 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 > ------------------------------------------------------- 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