From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,953e1a6689d791f6 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,953e1a6689d791f6 X-Google-Attributes: gid103376,public X-Google-Thread: fdb77,953e1a6689d791f6 X-Google-Attributes: gidfdb77,public X-Google-Thread: f79bb,953e1a6689d791f6 X-Google-Attributes: gidf79bb,public From: dbudor@zems.fer.hr (Darko BUDOR) Subject: Re: Eiffel and Java Date: 1996/11/02 Message-ID: <55ffdb$cki@bagan.srce.hr>#1/1 X-Deja-AN: 193945304 distribution: world references: <550sm2$sn1@buggy.news.easynet.net> <55562c$nkd@mulga.cs.mu.OZ.AU> followup-to: comp.lang.eiffel,comp.lang.ada,comp.lang.sather,comp.lang.java.advocacy content-type: text/plain; charset=US-ASCII organization: ZEMS-FER mime-version: 1.0 newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.sather,comp.lang.java.advocacy Date: 1996-11-02T00:00:00+00:00 List-Id: Fergus Henderson (fjh@mundook.cs.mu.OZ.AU) wrote: : donh@syd.csa.com.au (Don Harrison) writes: : : >What is the purpose of separating interface and implementation inheritance? : : Suppose I have two existing library classes (perhaps supplied by different : vendors) which have some commonality, but don't inherit from a common : base class. In Sather, one can simply create a new interface and : declare these classes to be instances of this interface, without : modifying the existing code. : : (Is that possible in Java?) Yes, it is. Suppose you have 2 classes from different vendors, class A and class B, with common methods void foo() and void bar(). You can declare an interface for common methods: public interface common { public void foo(); public void bar(); } Now declare 2 new classes: public class MyA extends A implements common { /* need constructors */. }; public class MyB extends B implements common {}; and use MyA and MyB instead of A and B. -- Darko Budor -- budor@fly.cc.fer.hr; dbudor@diana.zems.fer.hr All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. --IBM maintenance manual, 1925