🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #250

Re: Multiple interfaces

#250
From: Coho (Richard Swain)
Date: Sun, 23 Jun 2002 09:09
37 lines
3013 bytes
It doesn't break encapsulation, you only have limited access to the 
Object and if your implementation is not declared public (i.e it has 
package scope) then you cannot get to it via casting down the interface. 
Thus you are limited to calling only methods on the public interfaces 
(which is good)

Rich

Tristan Reeves wrote:


[snip]


> 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.
> 
> 



-- 
http://www.krang.f9.co.uk
Technical Details
Message-ID: <3D15902E.8070709@krang.f9.co.uk>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.174.75.178!news-fra1.dfn.de!newsfeed.hanau.net!newsfeed01.sul.t-online.de!t-online.de!newspeer1-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!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> <1024797220.174258@web.apex.net.au>

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-23 02:08:32 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.174.75.178!news-fra1.dfn.de!newsfeed.hanau.net!newsfeed01.sul.t-online.de!t-online.de!newspeer1-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail
Message-ID: <3D15902E.8070709@krang.f9.co.uk>
From: "Coho (Richard Swain)" <vibron@krang.f9.co.uk>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530
X-Accept-Language: en,ru
MIME-Version: 1.0
Newsgroups: aus.computers.java,borland.public.jbuilder.java.language,comp.lang.java.programmer
Subject: Re: Multiple interfaces
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> <1024797220.174258@web.apex.net.au>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 38
Date: Sun, 23 Jun 2002 10:09:02 +0100
NNTP-Posting-Host: 213.104.40.100
X-Complaints-To: abuse@ntlworld.com
X-Trace: news6-win.server.ntlworld.com 1024823311 213.104.40.100 (Sun, 23 Jun 2002 10:08:31 BST)
NNTP-Posting-Date: Sun, 23 Jun 2002 10:08:31 BST
Organization: ntlworld News Service