Article View: borland.public.jbuilder.java.language
Article #8488Re: Is "return super;" a valid statement
From: John McGrath TeamB
Date: Sat, 17 Mar 2001 07:43
Date: Sat, 17 Mar 2001 07:43
35 lines
1962 bytes
1962 bytes
On Fri, 16 Mar 2001 11:03:41 -0800, "Ralph Quapp" <-> wrote:
> I encountered a compile error in one of my classes when
> using the statement "return super;" and compiling it with
> javac or jikes. JBuilder does not complain. In my example
> doSomething() in class B contains this statement.
>
> The error reported is:
>
> Error in file ReturnType.java at line 31, column 37: '.'
> expected
>
> I am wondering now whether the statement is valid or not?
> And of course why?
I do not believe it is valid.
Assuming you are trying to refer to the "this" object as a member of
the superclass, there is no need to do anything special. "this" is by
definition a member of its class's superclass. You could just return
"this".
However, there is no need for that code at all. Since the superclass
method returns "this", you would be overriding it with a method that
does the exact same thing as the overridden method. So you could just
delete the overriding method.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.151cdabe37c2b74f98a084@forums.borland.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!209.92.40.60References:
<3ab26402$1_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-16 23:44:09 PST From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language Subject: Re: Is "return super;" a valid statement Date: Sat, 17 Mar 2001 02:43:04 -0500 Message-ID: <MPG.151cdabe37c2b74f98a084@forums.borland.com> References: <3ab26402$1_1@dnews> X-Newsreader: MicroPlanet Gravity v2.30 NNTP-Posting-Host: 209.92.40.60 X-Trace: 16 Mar 2001 23:38:52 -0800, 209.92.40.60 Lines: 35 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!209.92.40.60