INFO1110 Lecture Notes - Lecture 5: Harper Lee, Init, Order Of Merit

21 views1 pages

Document Summary

An instance attribute is a variable whose value is unique to each object: this variable is only accessible in the scope of this object, it is de ned inside the constructor function, __init__(self, ), of the class. A class attribute is a python variable that belongs to a class rather than a particular object: it is shared between all the objects of this class, we de ne class attributes outside of the constructor function. Instance methods: must have self when declaring the method"s de nition, needs speci c instance of an object for invocation. Class methods: can be invoked using class name. Does not need object for invocation: cannot reference an instance variable, cannot invoke instance methods of the class. Unless it has an object and uses this object in invocation.

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