I used Pythons source code/documentation/textbook to come up with an abstract class and following subclasses.
My requirements are:
- Domestic students don't require documentation
International student do require documentation (passports, etc..)
from abc import ABCMeta class Student(metaclass=ABCMeta): def __init__(self, id, firstname, lastname): self.__id = id self.__firstname = firstname self.__lastname = lastname @property def iden(self): return self.__id @property def first_name(self): return self.__firstname @property def last_name(self): return self.__lastname
International Subclass:
from Student import Student
from copy import deepcopy
class International(Student):
def __init__(self, iden, firstname, lastname, docuemnts):
super().__init__(iden, firstname, lastname)
self.__documents = deepcopy(docuemnts)
self.__type_of_student = "International"
@property
def international_documents(self):
return deepcopy(self.__documents)
Domestic Subclass:
from Student import Student
class Domestic(Student):
def __init__(self, iden, firstname, lastname):
super().__init__(iden, firstname, lastname)
self.__type_of_student = "Domestic"
@property
def student_type(self):
return self.__type_of_student
Have I constructed and implementation the abstract
class
correctly?