🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.programmer
Article #171

calling method of super class of super class

#171
From: Carsten Friedrich
Date: Tue, 01 May 2001 00:52
25 lines
1707 bytes
Hi,

is it possible to call a method of the super class of the super class?
E.g. (Pseudo java):

Class A { void f() { print "a";}}

Class B extends A { void f() {print "b"};}

Class C extends B { void f() {  A.f();}}

unfortunately Java does not allow me to do it like that (unless f is
static). Is there another way?

I can imagine some workarounds which all have some flaws:
 - reimplement the method from A , problem: the implementation of
   A.f() might not be known to me.

 - Have a class variable 'a' of type 'A' and call 'a.f()', which     
   wastes memory and does not always work ( A might be abstract)
 and so on ....

Is there a good solution?

Carsten
Technical Details
Message-ID: <3aee0699.231503@news.usyd.edu.au>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!news1.optus.net.au!optus!news.usyd.edu.au!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10a146,edae50d7b645c6ea,start
X-Google-Attributes: gid10a146,public
X-Google-Thread: 10d6db,edae50d7b645c6ea,start
X-Google-Attributes: gid10d6db,public
X-Google-ArrivalTime: 2001-04-30 17:56:54 PST
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!news1.optus.net.au!optus!news.usyd.edu.au!not-for-mail
From: Carsten.Friedrich@gmx.de (Carsten Friedrich)
Newsgroups: comp.lang.java.programmer,aus.computers.java
Subject: calling method of super class of super class
Date: Tue, 01 May 2001 00:52:20 GMT
Organization: The University of Sydney, Australia
Lines: 26
Message-ID: <3aee0699.231503@news.usyd.edu.au>
NNTP-Posting-Host: carsten.cs.usyd.edu.au
X-Trace: spacebar.ucc.usyd.edu.au 988678613 21963 129.78.8.250 (1 May 2001 00:56:53 GMT)
X-Complaints-To: usenet@news.usyd.edu.au
NNTP-Posting-Date: 1 May 2001 00:56:53 GMT
X-Newsreader: Forte Free Agent 1.21/32.243