Namnändringar

This commit is contained in:
2018-03-15 15:57:10 +01:00
parent 0e9132c795
commit b7346fbbd8
2 changed files with 0 additions and 2 deletions

21
Pass2/4 Inheritance.py Executable file
View File

@@ -0,0 +1,21 @@
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())