Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python classes and objects

class employee:
    name = ''
    id = 0
    department = ''

    def pay(self):
        print(self.name, self.id, self.department)


s = employee()
s.name = 'burhan'
s.id = 0o2234523
s.department = 'Development'
s.pay()

b = employee()
b.name = 'Abdullah'
b.id =12423432857
b.department = 'Software Engineer'
b.pay()

c = employee()
c.name = 'Bilal'
c.id =12423432857
c.department = 'Software Engineer'
c.pay()
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #python #classes #objects
ADD COMMENT
Topic
Name
4+1 =