a. What is an "abstract data type"(ADT)? ( Long answer, 6 points).
b. Describe an example of a simple ADT that illustrates your definition. ( 4
points ).
c. How would your code your example ADT in C++? (5 points)
2a. How do you show in UML that
- a. a class is an interface?
- b. a class is abstract?
- c. one class implements or realizes another abstract class?
- d. one class uses an interface and another class implements the
interface?
Answer:
[ 15ole.gif ]
2b. Here
[ 14q.cpp ]
is a file with three classes: A, B, and C. Which is a client, which is an
interface, and which implements the interface?
List the advantages of defining ADTs in two separate parts: specification and
implementation.
List the design requirements for a language that supports abstract data types.
Give examples of 3 different languages with different support for ADTs and
describe the way each supports them.
The run time stack in a language environment is an implementation of the Stack
ADT. Write a specification for the ADT Stack.
- a. Describe the C++ mechanism for defining and implementing
abstract data types.
- b. What is wrong with the C++ approach?
Explain how Java differs from C++ with respect to providing data abstraction.
What has been added? What has been removed?
Explain how the three parts of an Ada package work: Public, Private, and Body.