Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Osoba:
- def __init__(self, name, last_name, age):
- self.name = name
- self.last_name = last_name
- self.age = age
- def get_name(self):
- return self.name
- def get_last_name(self):
- return self.last_name
- def get_age(self):
- return self.age
- class Employee(Osoba):
- def __init__(self, name, last_name, age, salary, position):
- super().__init__(name, last_name, age)
- self.salary = salary
- self.position = position
- def get_salary(self):
- return self.salary
- def get_position(self):
- return self.position
- # Przykładowa inicjalizacja obiektu klasy Employee
- employee = Employee("Jan", "Kowalski", 45, 5000, "Manager")
- # Wyświetlenie danych pracownika
- print(f"Employee: {employee.get_name()} {employee.get_last_name()}, Age: {employee.get_age()}")
- print(f"Position: {employee.get_position()}, Salary: {employee.get_salary()} PLN")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement