Instance and class variables in python

 class Employee:

    profession="Networking" # its belong to all over object
    pass

umair=Employee()
rehman=Employee()

umair.name="Umair"
umair.salary=3000
umair.role="A55dmin"

rehman.name="rehman"
rehman.salary=2000
rehman.role="employee"
rehman.profession="worker"
# print(umair.name,rehman.role)
# print(rehman.profession)
print(Employee.profession)
print(rehman.__dict__)
rehman.profession# instance varible from
print(Employee.profession)

Comments