Re: Abstract Data Types - Separating Interface from Implementation
From: Jeffrey Schwab (jeffplus_at_comcast.net)
Date: 12/24/03
- Previous message: osmium: "Re: Permutations"
- In reply to: Jeff Schwab: "Re: Abstract Data Types - Separating Interface from Implementation"
- Next in thread: John Carson: "Re: Abstract Data Types - Separating Interface from Implementation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 24 Dec 2003 09:13:40 -0500
Correction:
>> 4) Are abstract data types "abstract" because they are specified
>> separate to implementation?
I see now that you were asking about abstract data types, not abstract
classes. Abstract, in the sense you used it, means only that the
implementation is hidden from the user. This usually means an extra
level of redirection is needed, and the redirection is usually through a
pointer. One popular approach is to have a *factory* or static method
return a pointer to a class implementing the interface, and another is
the "pimpl" method John Carson already mentioned.
> No. An abstract class is special, in that it does not have definitions
> for all of its methods. Such an undefined method is called "pure
> virtual." Since the class is not completely defined, it can never be
> instantiated; that's what makes it "abstract." Such a class is useful
> because each class "derived" from it can provide a different
> implementation of each virtual function. This feature supports a design
> style called "polymorphism." To understand polymorphism, you first need
> to have a basic understanding of a technique called "inheritance." See
> chapter 12 of TC++PL.
- Previous message: osmium: "Re: Permutations"
- In reply to: Jeff Schwab: "Re: Abstract Data Types - Separating Interface from Implementation"
- Next in thread: John Carson: "Re: Abstract Data Types - Separating Interface from Implementation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|