COMPSCI 61A Lecture Notes - Lecture 16: Multiple Inheritance, Object-Oriented Programming, Init
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
Classes are objects too, so they have attributes. Class attribute: attribute of the class of an instance. Assignment statements wiht dot expression on their left-hand side affect attributes for the object of that dot expression. If the obj is instance, assignment sets an instance attribute. If obj is class, assignment sets a class attribute. A common use: two similar classes differ in their degree of specialization. The specialized class may have the same attributes as the general class, along with some special-case behavior. A checkingaccount is a specialized type of account. Most behavior is hsared w/ the base class account. Bank account that charges for withdrawals. Instead its part of looking up attribute by name, If it names an attrubte in the class, return the attribute value. 1: oterhwise , look up the name in teh base calss, if there is one, otherwise, look up the name in the base clas, if htere is one.