COMPSCI 61A Lecture Notes - Lecture 15: Init, Object-Oriented Programming
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
Each object has its own local state. Each object also knows how to manage its own local state based on method calls. Method calls are messages passed between objects. Several objects can be instances of a common type. Different types may relate to each other. Specialized syntax and vocab to support behavior. A class serves as a template for its instances. All bank accounts have a balance and an account holder. Account class hsould add those attribtutes to each newly created instance. All bank acounts share a withdraw method" and a deposit" method. Nose and dance are attributes of class clown. _init_ method of the class is called with new objects with its first arguement, w/ any additional args provided in the call expression. Init is called the constructor: special b/c whenever class is called, gets called automatically. Every obj that is instance of user-defined class has unique identity. Operators is/ is not test if objects are the same.