🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #249

Re: Multiple interfaces

#249
From: Tristan Reeves
Date: Sun, 23 Jun 2002 01:53
31 lines
2896 bytes
"Coho (Richard Swain)" <vibron@krang.f9.co.uk> wrote in message
news:3D1432AC.70904@krang.f9.co.uk...
> Tristan Reeves wrote:
> [snip]
> >
> > By the way, does anyone know if there is a "base" interface type -
> > equivalent of Object? I don't believe there is, but just want to make
sure.
> >
> > Tristan.
> >
>
> There isn't but I'm not sure what benefit it would give?
>
Nothing, seeing that you can pass an interface reference to a method
requiring an Object parameter (which I didn't know when I posted my lat
message).
eg If I have method myMethod(Object o), and an interface MyInterface, and a
ref to a MyInterface (call it rMyInterface), then I can call
myMethod(rMyInterface).

This is quite strange, because clearly MyInterface does not "extend" Object
in any conventional way (this is true because you can't call Object methods
from an interface reference), and yet once the interface has been passed to
myMethod, it seems that I have access to the Object that is implementing the
interface - this seems possible too by a straight typecast to Object.

Doesn't this break encapsulation??

Tristan.
Technical Details
Message-ID: <1024797220.174258@web.apex.net.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!news1.optus.net.au!optus!news.mel.connect.com.au!news.can.connect.com.au!not-for-mail
References: <1024283082.192985@web.apex.net.au> <JScP8.111$Fv1.17660@newsread2.prod.itd.earthlink.net> <1024289793.45649@web.apex.net.au> <pan.2002.06.17.07.46.24.235390.777@databasix.com> <3D0F7E91.5010401@krang.f9.co.uk> <3d10edc6.1491361@news.virgin.net> <3D1101BE.40506@krang.f9.co.uk> <3d121553.1321895@news.virgin.net> <3D126A72.4123E49B@i.hate.spam> <1024711986.718420@web.apex.net.au> <3D1432AC.70904@krang.f9.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10a146,113f3357bc588129
X-Google-Attributes: gid10a146,public
X-Google-Thread: 10d6db,113f3357bc588129
X-Google-Attributes: gid10d6db,public
X-Google-Thread: f74b3,113f3357bc588129
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2002-06-22 20:32:35 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!news1.optus.net.au!optus!news.mel.connect.com.au!news.can.connect.com.au!not-for-mail
From: "Tristan Reeves" <moonshine@apex.net.au>
Newsgroups: aus.computers.java,borland.public.jbuilder.java.language,comp.lang.java.programmer
Subject: Re: Multiple interfaces
Date: Sun, 23 Jun 2002 11:53:43 +1000
Organization: APEX Internet
Lines: 33
Message-ID: <1024797220.174258@web.apex.net.au>
References: <1024283082.192985@web.apex.net.au> <JScP8.111$Fv1.17660@newsread2.prod.itd.earthlink.net> <1024289793.45649@web.apex.net.au> <pan.2002.06.17.07.46.24.235390.777@databasix.com> <3D0F7E91.5010401@krang.f9.co.uk> <3d10edc6.1491361@news.virgin.net> <3D1101BE.40506@krang.f9.co.uk> <3d121553.1321895@news.virgin.net> <3D126A72.4123E49B@i.hate.spam> <1024711986.718420@web.apex.net.au> <3D1432AC.70904@krang.f9.co.uk>
NNTP-Posting-Host: news.apex.net.au
X-Trace: auwa.connect.com.au 1024797220 10656 210.9.132.20 (23 Jun 2002 01:53:40 GMT)
X-Complaints-To: abuse@connect.com.au
NNTP-Posting-Date: 23 Jun 2002 01:53:40 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Cache-Post-Path: web.apex.net.au!unknown@210.9.133.105
X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/)