I made a class named 'employee' as below. I can access the class variable 'company' directly through class itself but cant access it using 'getCompany()' method. What is wrong with my code? Since I am newbie to OOP concepts, please grant me detailed but step-wise elaboration of the concepts.
<!-- language: lang-python -->
>>> class employee:
company = 'ABC Corporation'
def getCompany():
return company
>>> employee.company #####this does as expected
'ABC Corporation'
>>> employee.getCompany() #####what is wrong with this thing???
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
employee.getCompany()
File "<pyshell#13>", line 4, in getCompany
return company
NameError: name 'company' is not defined #####says it is not defined