I an new to programming, I progressed to oop in python using different books but when I get to oop things go very wrong. then I went on-line but but I still get errors when I run an example code which ran perfectly on their system. For example this code I found on tutorialspoint:
'common base class for all employees'
print "Total employee %d"%Employee.empCount
print "Total employee(s)%d"%employee.empCount
when they ran it it printed on the screen this:
Name : Zara ,Salary: 2000
Name : Manni ,Salary: 5000
Total Employee 2
but if I run the same code I get this:
Traceback (most recent call last):
File "J:\employee.py", line 20, in <module>
File "J:\employee.py", line 14, in displayEmployee
AttributeError: Employee instance has no attribute 'name'
this same error is produced any time I run any python code on oop
I mean is OOP not for everyone?
because I am sick and tired of this rubbish