#!/usr/bin/env python2 # -*- coding: utf-8 -*- class Employee: _ID=1 def __init__(self, imie, nazwisko): self.imie = imie self.nazwisko = nazwisko self.id = self._ID self.__class__._ID += 1 def get_id(self): return self.id class Recruiter(Employee): recruited = [] def recruit(self, Employee): self.recruited.append(Employee.get_id()) class Programmer(Employee): def __init__(self, imie, nazwisko, Recruiter): Employee._ID += 1 super().__init__(imie, nazwisko) self.recruiter = Recruiter.id pracownik = Employee("Jan","Nowak") pracownik2 = Employee("Adam","Kowalski") pracownik3 = Employee("Piotr","Adolfowski") print(pracownik.get_id(),pracownik2.get_id(),pracownik3.get_id()) rekruter = Recruiter("Andrzej","Mściszewski") rekruter.recruit(pracownik) print(rekruter.id, rekruter.imie, rekruter.nazwisko, rekruter.recruited) programista = Programmer("Bill", "Gates", rekruter) print(programista.id, programista.imie, programista.nazwisko, programista.recruiter)