{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

27-review.student - Closed-book closed-notes exam similar...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Closed-book, closed-notes exam, similar to the format of the midterm. Exam room assignments: Friday, April 23rd, 10:30-12:30. Room assignments TBA. Alternate exam, ONLY WITH PERMISSION: Friday, April 23rd, 1:30-3:30. Room TBA. Math 215/255 students will be automatically placed in the alternate exam. We think that's everyone with a conflict. If you hav a conflict due to some other class you *must* tell us by the end of the day on Tuesday, or you can't take it. There is a review session being scheduled for Wednesday. Details TBA. ++++++++++++++++++++++++++++++++++++++++++++++ Over the course of this semester, we've covered a lot of material. Today we'll review the high points of the second half of the course. We started the second half of the course talking about abstract data types, or ADTs. Abstract data types provide the following two advantages to their clients: * information hiding: clients don't know the details of *how* the object is represented, nor do clients know the operations on those objects are implemented. * encapsulation: the objects and their operations are defined in the same place operation in one entity. An ADT consists of two pieces: * An interface: the contract that specifies what the client must do to use the ADT, and what the implementor will provide. * An implementation: a realization of the ADT that adheres to the contract. Includes both a concrete representation, and the functions that operate over that representation. Types in a program form a "type forest" --- a collection of type hierarchies. One type can be a subtype of another if it satisfies the *substitution principle*: Given two types, S and T, if S < T, then code written to
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Sheet1 Page 2 correctly use type T will still be correct if type S is substituted for type T. More formally, a type S is a subtype of type T only if: S provides operations on the type in addition to those T provides. (Substitutable because code won't use) S only modifies the operations provided by T by either: * weakening the preconditions (substitutable because stronger preconds still hold) * strengthening the postconditions (substitutable because weaker postconds still hold) The "preconditions" of an operation are specified by its argument types and applicable REQUIRES clauses. The "postconditions" are specified by its return/reference types and applicable EFFECTS/MODIFIES clauses. +++++++++++++++ The C++ mechanism used to implement ADTs is called a "class". A class is a kind of type that can contain: * data members----the "concrete representation" of the ADT * methods---the "operations" available on the ADT The representation should be visible only to the implementor, not the clients.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}