Article View: borland.public.jbuilder.java.language
Article #8475Re: Is "return super;" a valid statement
From: Dave Bird
Date: Fri, 23 Mar 2001 18:26
Date: Fri, 23 Mar 2001 18:26
24 lines
1992 bytes
1992 bytes
In article <3ab6816f_1@dnews>, Ralph Quapp <-@?.?> writes
>Ok, the example was a bit to simple or I did not explain the intended use
>well enough:
>
>In fact I want to return a reference to an instance of class A, only. Class
>B was only intended to prepare class A for a specific usage, and it is not
>intended to be used any further. I therefore wanted to 'remove' the B part
>of the instance. But probably - even when it would be a valid construct - it
>would not work as it still will behave polymorphic (tested with JBuilder).
If
ClassB extends ClassA{ has
ClassA makeA(int x){ then, as I explained, what you want is
return (ClassA)this;
....
}
......
}
assuming you want to return the current object
but viewed as being of its superclass type.
--
^-^-^-@@-^-;-^ http://www.xemu.demon.co.uk/
(..)__u news:alt.smoking.mooses
Technical Details
Message-ID:
<yu3+eYAGV5u6EwVU@xemu.demon.co.uk>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!194.176.220.129!newsfeed.icl.net!dispose.news.demon.net!news.demon.co.uk!demon!xemu.demon.co.uk!daveReferences:
<3ab26402$1_1@dnews> <MPG.151cdabe37c2b74f98a084@forums.borland.com> <MPG.151df2148cd2b2f398a08a@forums.borland.com> <3ab6816f_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a2b6df84216d25a2 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-23 15:22:23 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!194.176.220.129!newsfeed.icl.net!dispose.news.demon.net!news.demon.co.uk!demon!xemu.demon.co.uk!dave From: Dave Bird <dave@xemu.demon.co.uk> Newsgroups: borland.public.jbuilder.java.language Subject: Re: Is "return super;" a valid statement Date: Fri, 23 Mar 2001 18:26:14 +0000 Organization: none Message-ID: <yu3+eYAGV5u6EwVU@xemu.demon.co.uk> References: <3ab26402$1_1@dnews> <MPG.151cdabe37c2b74f98a084@forums.borland.com> <MPG.151df2148cd2b2f398a08a@forums.borland.com> <3ab6816f_1@dnews> NNTP-Posting-Host: xemu.demon.co.uk X-NNTP-Posting-Host: xemu.demon.co.uk:158.152.196.209 X-Trace: news.demon.co.uk 985389382 nnrp-01:17221 NO-IDENT xemu.demon.co.uk:158.152.196.209 X-Complaints-To: abuse@demon.net MIME-Version: 1.0 X-Newsreader: Turnpike Integrated Version 5.00 U <dQumtnY$x4rJ2u5tL5fS$n2vuP> Lines: 24