Article View: borland.public.jbuilder.java.language
Article #19837Re: Multiple Inheritance
From: junki
Date: Fri, 05 Dec 1997 00:00
Date: Fri, 05 Dec 1997 00:00
64 lines
3094 bytes
3094 bytes
This is a multi-part message in MIME format. --------------E5DE084ADF0A13AF82BCEEB9 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Probably you already have meet the terms "is-a", "has-a" and "acts-as". Those terms are very common in Java parlance. When you declare a class B that extends class A you are saying that class B "is-a" class A with other things. That�s inheritance and oposite to a "has-a" approach where one class has a instance of another class as member. Interfaces in Java is a implementation to the "act-as" approach. Consider the interface DataInput in java.io package. Any class that intends to act as data input for a program implements this interface (such as various classes in JDK 1.1 core API). In your program you can declare a instance of DataInput meaning any class that implements such interface can be referenced by that instance. It doesn�t matter if input will be the network or a file in local disk or keybord. Your program just knows what it needs: the input methods signatures. Sds, Julio Junki Shinzato Blake Williams wrote: > > To add another question, what is the point of using an interface? To my > knowledge, an interface only predefines the method names you must write, > but doesn't provide any code. If you have to write the methods anyway, > why would you want to inherit an interface? Wouldn't it make more sense > to just write the methods within your class and have complete freedom to > write them to best fit your situation? please clarify. Thanks. > > Blake Williams > > Bruno da Silva Bozza wrote: > > > Does anyone know why there is multiple interface inheritance in > > Java, but not multiple class inheritance. --------------E5DE084ADF0A13AF82BCEEB9 Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Julio J Shinzato Content-Disposition: attachment; filename="vcard.vcf" begin: vcard fn: Julio J Shinzato n: Shinzato;Julio J org: Ministerio da Fazenda - Secretaria de Receita Federal adr: R. Goias 151 - 6o. Andar - Ala A;;;Belo Horizonte;Minas Gerais;30.170-917;Brazil email;internet: shinzato@inet.com.br title: Tecnico do Tesouro Nacional - Informatica tel;work: +55 031 218-6617 tel;fax: +55 031 222-5252 note: Lotus Notes: jjunki/SRF x-mozilla-cpt: ;0 x-mozilla-html: TRUE version: 2.1 end: vcard --------------E5DE084ADF0A13AF82BCEEB9--
Technical Details
Message-ID:
<34887F78.30EFE7A1@inet.com.br>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34820D78.3F11372@aol.com.br> <3485C809.1DF172D5@dmwgroup.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,80129170e9818cce X-Google-Attributes: gidf74b3,public From: junki <shinzato@inet.com.br> Subject: Re: Multiple Inheritance Date: 1997/12/05 Message-ID: <34887F78.30EFE7A1@inet.com.br> X-Deja-AN: 295589170 References: <34820D78.3F11372@aol.com.br> <3485C809.1DF172D5@dmwgroup.com> Organization: Ministerio da Fazenda - Secretaria de Receita Federal Reply-To: shinzato@inet.com.br Newsgroups: borland.public.jbuilder.java.language