-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_OOP.py
More file actions
22 lines (18 loc) · 754 Bytes
/
Copy pathPython_OOP.py
File metadata and controls
22 lines (18 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Employee:
def __init__(self, name, salary):
self.name = name
self.salary = salary
def get_details(self):
print(f"The employee's name is {self.name} and his/her salary is {self.salary}€")
class Manager(Employee):
def promote(self, employee):
employee.salary += (employee.salary * 10) / 100.0
class Developer(Employee):
def __init__(self, name, salary, programming_language):
super().__init__(name, salary)
self.programming_language = programming_language
manager = Manager(name='Stavros',salary=1600)
developer = Developer(name='Anastasia',salary=1000, programming_language='Python')
manager.promote(developer)
manager.get_details()
developer.get_details()