adolphuZ

Untitled

Jun 5th, 2024
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. class Osoba:
  2.     def __init__(self, name, last_name, age):
  3.         self.name = name
  4.         self.last_name = last_name
  5.         self.age = age
  6.  
  7.     def get_name(self):
  8.         return self.name
  9.  
  10.     def get_last_name(self):
  11.         return self.last_name
  12.  
  13.     def get_age(self):
  14.         return self.age
  15.  
  16. class Employee(Osoba):
  17.     def __init__(self, name, last_name, age, salary, position):
  18.         super().__init__(name, last_name, age)
  19.         self.salary = salary
  20.         self.position = position
  21.  
  22.     def get_salary(self):
  23.         return self.salary
  24.  
  25.     def get_position(self):
  26.         return self.position
  27.  
  28. # Przykładowa inicjalizacja obiektu klasy Employee
  29. employee = Employee("Jan", "Kowalski", 45, 5000, "Manager")
  30.  
  31. # Wyświetlenie danych pracownika
  32. print(f"Employee: {employee.get_name()} {employee.get_last_name()}, Age: {employee.get_age()}")
  33. print(f"Position: {employee.get_position()}, Salary: {employee.get_salary()} PLN")
  34.  
Add Comment
Please, Sign In to add comment