diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8664fcc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +*.p[oc] diff --git a/beispiele/employeeclass2.py b/beispiele/employeeclass2.py new file mode 100644 index 0000000..db1bd03 --- /dev/null +++ b/beispiele/employeeclass2.py @@ -0,0 +1,35 @@ +# employeeclass1.py + +from personclass2 import Person + + +class Employee(Person): + + def __init__(self, name="", age=0, gender=None, employee_id=None, salary=0): + super().__init__(name=name, age=age, gender=gender) + self.employee_id = employee_id + self.salary = salary + + def __str__(self): + return f"Employee: name={self.name} employee_id={self.employee_id}" + + +employee1 = Employee() + +print(employee1) +print(employee1.__class__) +print(employee1.name) +print(employee1.age) +print(employee1.gender) + +employee2 = Employee("Joe Doe", 32, gender="m", employee_id=1, salary=2000) + +print(employee2) +print(employee2.__class__) +print(employee2.name) +print(employee2.age) +print(employee2.gender) +print(employee2.employee_id) +print(employee2.salary) + + diff --git a/beispiele/personclass2.py b/beispiele/personclass2.py index b122999..ef669d0 100644 --- a/beispiele/personclass2.py +++ b/beispiele/personclass2.py @@ -1,4 +1,4 @@ -# personclass1.py +# personclass2.py class Person: