Article View: borland.public.jbuilder.java.language
Article #14919Re: Really simple question
From: Tom Davies
Date: Sun, 18 Jul 1999 00:00
Date: Sun, 18 Jul 1999 00:00
32 lines
1316 bytes
1316 bytes
Pete Blacker wrote:
>
> Hi
>
> How do you define an abstract class. The code I've got at the moment
> looks like this
>
> -----------
> package Kernel;
>
> public class MyClass
> {
> public abstract boolean Save(FileWriter File);
> }
> -----------
>
> This produces the error class Kernel.MyClass must be declared abstract.
> In C++ you declared any virtual function as pure and the class became
> abstract. How does this work in Java?
> Thanks.
>
> Pete Blacker
Same way you declare an abstract method -- use the abstract modifier,
i.e.:
public abstract class MyClass { ... }
By the way, if you have an abstract class which has *only* abstract
methods you should probably make it an interface.
Tom
Technical Details
Message-ID:
<3791E5D1.959570BB@smartchat.net.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3790A080.BB89BD7F@comicjunk.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,231bed597c998f1b X-Google-Attributes: gidf74b3,public From: Tom Davies <tom@smartchat.net.au> Subject: Re: Really simple question Date: 1999/07/18 Message-ID: <3791E5D1.959570BB@smartchat.net.au> X-Deja-AN: 502288281 Content-Transfer-Encoding: 7bit References: <3790A080.BB89BD7F@comicjunk.com> To: Pete Blacker <pete@comicjunk.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language