CMPT 120 Lecture Notes - Lecture 30: Unified Modeling Language

21 views2 pages
meghan78 and 39786 others unlocked
CMPT 120 Full Course Notes
29
CMPT 120 Full Course Notes
Verified Note
29 documents

Document Summary

To make sure of this, place two underscores (__) in front of attribute name. Filename for module must end in . py. Module can be imported to programs that use the class. Instance attribute: belongs to a specific instance of a class. Created when a method uses the self parameter to create an attribute. If many instances of a class are created, each would have its own set of attributes. Typically, all of a class"s data attributes are private and provide methods to access and change them. Accessor methods: return a value from a class"s attribute without changing it. Safe way for code outside the class to retrieve the value of attributes. Mutator methods: store or change the value of a data attribute. Methods and functions often need to accept objects as arguments. When you pass an object as an argument, you are actually passing a reference to the object. The receiving method or function has access to the actual 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

Related Questions