forked from tdwojak/Python2017
commited tasks
This commit is contained in:
parent
3b84741c12
commit
6fd225e26b
@ -2,19 +2,57 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class Employee:
|
class Employee:
|
||||||
id_prac = 1
|
id_prac = 0
|
||||||
def __init__ (self,imie, nazwisko):
|
def __init__ (self,imie, nazwisko):
|
||||||
|
Employee.id_prac += 1
|
||||||
self.imie = imie
|
self.imie = imie
|
||||||
self.nazwisko = nazwisko
|
self.nazwisko = nazwisko
|
||||||
self.id_prac = Employee.id_prac
|
self.id_prac = Employee.id_prac
|
||||||
Employee.id_prac += 1
|
|
||||||
def get_id (self):
|
def get_id (self):
|
||||||
return self.id_prac
|
return self.id_prac
|
||||||
|
|
||||||
|
|
||||||
|
class Recruiter (Employee):
|
||||||
|
def __int__(self,imieR, nazwiskoR):
|
||||||
|
Employee.__init__(self,imieR, nazwiskoR)
|
||||||
|
self.recruited=[]
|
||||||
|
|
||||||
|
def recruit(self,id):
|
||||||
|
self.recruited.append(id)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '<Rekruter %s,%s,%s>' % (self.imieR, self.nazwiskoR, self.recruited)
|
||||||
|
|
||||||
|
class Programmer(Recruiter):
|
||||||
|
def __int__(self,imieP,nazwiskoP,rekruter):
|
||||||
|
Recruiter.__init__(self,imieP,nazwiskoP)
|
||||||
|
Recruiter.id_prac = rekruter
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '<Programista %s,%s, został zrekrutowany przez rekrutera o ID = >' % (self.imieP, self.nazwiskoP, Recruiter.id_prac)
|
||||||
|
|
||||||
|
|
||||||
prac1 = Employee("X1","Y1")
|
prac1 = Employee("X1","Y1")
|
||||||
prac2 = Employee("X2","Y2")
|
prac2 = Employee("X2","Y2")
|
||||||
|
prac3 = Employee("XY","Y3")
|
||||||
|
|
||||||
print(prac1.get_id())
|
print(prac1.get_id())
|
||||||
print(prac2.get_id())
|
print(prac2.get_id())
|
||||||
|
print(prac3.get_id())
|
||||||
|
|
||||||
|
print(Employee.id_prac )
|
||||||
|
|
||||||
|
prac4 = Recruiter('Rek1', 'RekN1')
|
||||||
|
print(prac4.imie)
|
||||||
|
print(prac4.nazwisko)
|
||||||
|
print(prac4.id_prac)
|
||||||
|
|
||||||
|
#to mi jeszcze nie działa
|
||||||
|
#prac5 = Programmer('Bozena','Bozeniasta', 4)
|
||||||
|
#print(prac5.imie)
|
||||||
|
#print(prac5.nazwisko)
|
||||||
|
#print(prac5.id_prac)
|
||||||
|
#print(prac5.get_id())
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user