company second example

This commit is contained in:
Mert Gör 🇹🇷 2023-07-01 17:53:43 +03:00
parent c448227747
commit 30f63c56dc
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
2 changed files with 51 additions and 0 deletions

41
python-temel/company.2.py Normal file
View File

@ -0,0 +1,41 @@
class Employee:
def __init__(self, name, address):
self.name = name
self.address = address
def disp(self):
print('Adı Soyadı: {}'.format(self.name))
print('Adres: {}'.format(self.address))
class Worker(Employee):
def __init__(self, name, address, shift):
super(Worker, self).__init__(name, address) # Employee.__init_(self, name, address)
self.shift = shift
def disp(self):
super(Worker, self).disp() # Employee,disp(self)
print('Vardiya: {}'.format(self.shift))
class Manager(Employee):
def __init__(self, name, address, department):
super(Manager, self).__init__(name, address) # Employee.__init__(self, name, address)
self.department = department
def disp(self):
super(Manager, self).disp() # Employee,disp(self)
self.department = department
def disp(self):
super(Manager, self).disp() # Employee.disp(self)
print('Departman: {}'.format(self.department))
class Executive(Manager):
def __init__(self, name, address, department, region):
super(Executive, self).__init__(name, address, department) # Manager.__init__(self, name, address, department)
self.region = region
def disp(self):
super(Executive, self).disp() # Manager.disp(self).
print('Bölge: {}'.format(self.region))
e = Executive('Salih Bulut', 'Kazlıçeşme', 'Üretim', "Ortadoğu")
e.disp()

View File

@ -0,0 +1,10 @@
class Employee:
def __init__(self, name, address):
self.name = name
self.address = address
def disp(self):
print('Adı Soyadı: {}'.format(self.name))
print('Adres: {}'.format(self.address))
class Worker(Employee)