CMPSC 24 Lecture 3: Lecture 3

20 views2 pages
18 Jan 2017
School
Course
Professor

Document Summary

Letting the objects collaborate to solve a problem. Description of a group of objects with similar properties. Separation of a data type"s logical properties from its implementation. Specific representation of the structure to hold the data items, and the coding for operations. Class = structured type that encapsulates a fixed number of data components (data members) The predefined operations on an instance of a class are whole assignment and component access. Container class = data type that is capable of holding a collection of items. Can be implemented as a class with member functions to add, remove, examine items. You can check how many occurrences of certain numbers are in the bag. You can check how many numbers are in the bag. The bag class (bag. h) class bag { capacity = 100; public: // modifiers void insert(int element); bool remove(int element); // observers int total(); int howmany(int element); private: int data[capacity]; bag. cpp.

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