fork download
  1. import abc
  2. from abc import ABCMeta
  3.  
  4.  
  5. class Person(object, metaclass=ABCMeta):
  6. def __init__(self, first, last, age):
  7. self.firstname = first
  8. self.lastname = last
  9. self.age = age
  10.  
  11. @abc.abstractmethod
  12. def change_info(self):
  13. pass
  14.  
  15.  
  16. class Employee(Person):
  17. def __init__(self, first, last, age, staffnum):
  18. super(Employee, self).__init__(first, last, age)
  19. self.staffnumber = staffnum
  20.  
  21. def change_info(self, firstname, lastname, age, staffnum):
  22. self.firstname = firstname
  23. self.lastname = lastname
  24. self.age = age
  25. self.staffnum = staffnum
  26.  
  27.  
  28. y = Employee("Homer", "Simpson", 28, "1007")
  29. y.change_info("Harry", "Potter", 20, "322")
  30. print(y.firstname)
Success #stdin #stdout 0.03s 9984KB
stdin
Standard input is empty
stdout
Harry