INST 201 Lecture Notes - Lecture 10: Perim

93 views4 pages

Document Summary

Classes are a great way of packaging data and functionality in units that can be easily manipulated. If your program does not have classes, you might as well use another language that is not object-oriented! To call a member function, specify the object whose function you want to call, and use the dot operator followed by the function name. Public members of a class are directly accessible from an object by use of the dot operator, whereas private members can only be accessed from within the class itself. Keeping data members private shows good style for encapsulating data by allowing an object to communicate with the rest of the world only through its public member functions. Encapsulating data makes it more difficult for a programmer to make an accidental modification of a value. Friend functions are good for manipulation of objects when it does not make sense to assign the function to a single object.

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