2017-12-03 13:05:05 +01:00
|
|
|
#!/usr/bin/env python2
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2017-12-03 18:10:30 +01:00
|
|
|
class Employee:
|
2017-12-15 22:49:02 +01:00
|
|
|
id_prac = 0
|
2017-12-03 18:10:30 +01:00
|
|
|
def __init__ (self,imie, nazwisko):
|
2017-12-15 22:49:02 +01:00
|
|
|
Employee.id_prac += 1
|
2017-12-03 18:10:30 +01:00
|
|
|
self.imie = imie
|
|
|
|
self.nazwisko = nazwisko
|
|
|
|
self.id_prac = Employee.id_prac
|
2017-12-15 22:49:02 +01:00
|
|
|
|
2017-12-03 18:10:30 +01:00
|
|
|
def get_id (self):
|
|
|
|
return self.id_prac
|
|
|
|
|
|
|
|
|
2017-12-15 22:49:02 +01:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2017-12-03 18:10:30 +01:00
|
|
|
prac1 = Employee("X1","Y1")
|
|
|
|
prac2 = Employee("X2","Y2")
|
2017-12-15 22:49:02 +01:00
|
|
|
prac3 = Employee("XY","Y3")
|
2017-12-03 18:10:30 +01:00
|
|
|
|
|
|
|
print(prac1.get_id())
|
|
|
|
print(prac2.get_id())
|
2017-12-15 22:49:02 +01:00
|
|
|
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())
|
|
|
|
|
2017-12-03 18:10:30 +01:00
|
|
|
|