Start på pass 2

This commit is contained in:
2018-03-15 14:52:03 +01:00
parent ad6bc8642e
commit c39eae4ef4
6 changed files with 96 additions and 0 deletions

23
Pass2/Inheritance.py Executable file
View File

@@ -0,0 +1,23 @@
class Person:
def __init__(self, first, last):
self.firstname = first
self.lastname = last
def Name(self):
return self.firstname + " " + self.lastname
class Employee(Person):
def __init__(self, first, last, staffnum):
Person.__init__(self,first, last)
self.staffnumber = staffnum
def GetEmployee(self):
return self.Name() + ", " + self.staffnumber
x = Person("Marge", "Simpson")
y = Employee("Homer", "Simpson", "1337")
print(x.Name())
print(y.GetEmployee())