2.1.2. Abstraction Barriers
Exercise 2.3

Representation of rectangles on a plane

Implement a representation for rectangles in a plane. (Hint: You may want to make use of exercise 2.2.) In terms of your constructors and selectors, create procedures that compute the perimeter and the area of a given rectangle. Now implement a different representation for rectangles. Can you design your system with suitable abstraction barriers, so that the same perimeter and area procedures will work using either representation?



There are no comments yet.

Authentication required

You must log in to post a comment.

Login