Professional Documents
Culture Documents
Lec-8 (Classes - Objects)
Lec-8 (Classes - Objects)
Mukund Iyengar
ECE Department
miyengar@stevens
Agenda:
The Semantics
What it all boils down to:
#Create Class
class Simple:
pass
#Create Object
obj = Simple()
OOP at 30,000 feet
“Self” Awareness
C
raiseSalary(self)
printSalary(self)
…
“self”
“self” “self”
class Employee:
...
E1 = Employee()
E1.title = “Manager”
You can add a new attribute to an object, even if other objects will
never have that attribute and neither does the class definition!
Python rarely uses OOP
Why oh why?
Python is a scripted language meant for rapid prototyping, and less for creating software suits in
the traditional waterfall model
Software “Stacks”