EECS 280 Lecture 7: EECS 280 Lecture 7 – Abstract Data Types in C

94 views3 pages

Document Summary

Lecture 7 abstract data types in c. Recall: procedural abstraction: procedural abstraction separates what code does from how it works, we separate the interface from the implementation. C-style adts (structs: use a struct to represent the data, define functions for triangle behaviors. The first parameter is a pointer to the triangle struct we want to work with: define an initializer function to check the values used to initialize the triangle member variables. Representation invariants: a problem for compound types. O(cid:373)e (cid:272)o(cid:373)(cid:271)i(cid:374)atio(cid:374) of (cid:373)e(cid:373)(cid:271)e(cid:396) (cid:448)alues do(cid:374)"t (cid:373)ake se(cid:374)se togethe(cid:396: we use representation invariants to express the conditions for a valid compound object. Representation vs abstraction: we pick some way to represent our abstract concept with data (e. g. 3 doubles, only some possible values in the representation are valid (meaningful in the abstraction) C-style adts (structs: check invariants using asserts (project 2, other representations are possible. Plain old data: a simple compound type where the interface and implementation are the same.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents