COMPSCI 61A Lecture Notes - Lecture 15: Init

38 views2 pages
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents

Document Summary

Each objects also knows how to manage its own local state, based on method calls. Several object may all be instances of a common type. Specialized syntax and vocabulary exists to support this metaphor. A class serves as a template for its instances. All instances of a class have certain variables assigned in their class. A class statement creates a new class that binds that class to in the first frame of the current environment. Assignment and def statements in create attributes of the class (not names in frames) A new instance of that class is created. The __init__ method of the class is called with the new object as its first argument (named self), along with any additional arguments provided in the first call expression. Every object that is an instance of a user-defined class has a unique identity. Every call to a class creates a new instance, but there is only one class of that name.

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