COMPSCI 61A Lecture Notes - Lecture 16: Eval, Init

43 views4 pages
24 Oct 2013
School
Professor
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents

Document Summary

All objects have attributes, which are name-value pairs. Instance attribute: attribute of an instance instance = created by calling class. Class attribute = attribute of class of an instance. Bound methods are object a function has first parameter as self already bound to instance. Dot expression evaluate to bound method for class attributes that are functions. Assignment statements with dot expression on left side affect attributes for object of dot expression. If the object is an instance, then assignment sets an instance attribute. If the object is a class, then assignment sets a class attribute tom_account. interest = 0. 08. Attribute assignment statement adds or modifies attribute name interest of tom_account expression tom_account eval to object, interest not looked up. A common use: two similar classes differ in degree of specialization. The specialized class may have same attributes as general class, along with some special behavior class (): Using inheritance, implement subclass by specify differences from base class.

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