Article View: a.bsu.programming
Article #2Re: JAVA: What are ABSTRACT CLASSES etc..?
From: L. M. Rappaport
Date: Thu, 09 Nov 1995 15:30
Date: Thu, 09 Nov 1995 15:30
52 lines
2726 bytes
2726 bytes
michael@w3media.com (Michael Mehrle) wrote (with possible editing):
>1) What the hell are "abstract classes"? The book describes it as
>"classes, which are made up of
>methods that have not been completed. It's up to the subclasses of the
>abstract class to override
>the method."
>I've no idea what that means. I understand the basic "extending" of
>classes by creating subclasses
>which override certain methods. So far so good. But I've no idea what
>"abstract classes do...
>HELP!
I've never seen Java, but I drink a lot of coffee, so... :)
Abstract classes are classes which are never instantiated; i.e., there
will never be any objects created from them. They exist to define a
basic interface meaning they exist to define the methods which will be
incorporated and possibly extended by their child classes who will
actually be used. In some languages, abstract classes may be
characterized by their use of deferred methods - methods which are
required for operation, but will be implemented further down the
chain.
>2) Which brings me to "interfaces" which don't make sense to me either.
>What is the major difference
>between an "interface" and a "superclass"?
>The book says the advantage is that you can define the protocols for an
>abstract class without worrying
>about the specific implementation, leaving that until later. WHY?
An abstract superclass usually exists to _define_ an interface, an
interface being the collection of public methods associated with a
class. Grady Booch defines an interface as "The outside view of a
class, object or module, which emphasizes its abstraction while hiding
its structure and the secrets of its behavior." ("Object-Otiented
Analysis and Design with Applications" 2d edition ISBN 0-8053-5340-2,
pg.515)
You might want to read the first four chapters of that book. Another
very useful book is "Designing Object-Oriented Software" by Rebecca
Wirfs-Brock, Brian Wilkerson and Lauren Wiener (ISBN 0-13-629825-7)
which has a good discussion of abstract classes starting on page 27.
I can't help you with casting classes or threading - perhaps someone
else will chime in.
Larry
--
rapp@lmr.com
Technical Details
Message-ID:
<DHs8II.5p@mv.mv.com>Path:
arc1-ca.pugleaf.net!news.sprintlink.net!mv!usenetReferences:
<michael-0811951703530001@ppp3.val.net>Show Full Headers
Complete Article Headers
Newsgroups: a.bsu.programming,comp.programming,comp.programming.threads,fj.net.programming,comp.lang.objective-c,comp.object,comp.lang.c++ Path: arc1-ca.pugleaf.net!news.sprintlink.net!mv!usenet From: rapp@lmr.com (L. M. Rappaport) Subject: Re: JAVA: What are ABSTRACT CLASSES etc..? Message-ID: <DHs8II.5p@mv.mv.com> Organization: L. M. Rappaport & Associates, Inc. Date: Thu, 9 Nov 1995 15:30:50 GMT References: <michael-0811951703530001@ppp3.val.net> X-Newsreader: Forte Agent .99b.112 X-Nntp-Posting-Host: lmr.com