Due: 4/13 12:30pm
Name & Perm #:
Homework buddy (leave blank if you worked alone):
Reading: "Abstract Data Types", PS 10.3
1 \( \)
Savitch makes the following observations in the introduction to Section 10.3:
"Unless … defined and used with care, programmer-defined types can be used in unintuitive ways that make a program difficult to understand and difficult to modify. The best way to avoid these problems is to make sure all the data types you define are ADTs. The way that you do this in C++ is to use classes, but not every class is an ADT. To make it an ADT you must define the class in a certain way…"
(4 pts) What does ADT stand for?
(4 pts) According to Savitch, a data type consists of a collection of values, together with … what?
(4 pts) According to Savitch, a data type is called an ADT if … what?
2 \( \)
Savitch describes two ways of characterizing what makes a class an ADT: first he describes two things that should be completely separated, and then he describes three rules for achieving that separation.
What are the two things that should be separated?
- (4 pts) First thing:
- (4 pts) Second thing:
3 \( \)
What are the three rules for keeping those things separate?
- (4 pts) Rule 1:
- (4 pts) Rule 2:
- (4 pts) Rule 3:
4 (4 pts)
When you define an ADT as a class, what items are considered part of the interface for the ADT?
5 (4 pts)
When you define an ADT as a class, what items are considered part of the implementation for the ADT?