Skip to main content
Rollback to Revision 3
Source Link
Peilonrayz
  • 44.6k
  • 7
  • 80
  • 158

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, type):
             self.__id = id
             self.__firstname = firstname
             self.__lastname = lastname 
    
         self.__type@property
     = type
    
    
     @property
      def iden(self):
             return self.__id
    
         @property
         def first_name(self):
             return self.__firstname
    
     @property
     def last_name(self):
      @property
       return self.__lastname
    
     @property
     def student_typelast_name(self):
             return self.student_type__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, "International")
 
        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?

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, type):
         self.__id = id
         self.__firstname = firstname
         self.__lastname = lastname
         self.__type = type
    
    
     @property
     def iden(self):
         return self.__id
    
     @property
     def first_name(self):
         return self.__firstname
    
     @property
     def last_name(self):
         return self.__lastname
    
     @property
     def student_type(self):
         return self.student_type
    

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, "International")

        self.__documents = deepcopy(docuemnts)

    @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, "Domestic")

Have I constructed and implementation the abstract class correctly?

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?

deleted 70 characters in body
Source Link
user150904
user150904

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, type):
             self.__id = id
             self.__firstname = firstname
             self.__lastname = lastname
     
         @property
     self.__type = type
    
    
     @property
     def iden(self):
             return self.__id
    
         @property
         def first_name(self):
             return self.__firstname
    
     @property
     def last_name(self):
      @property
       return self.__lastname
    
     @property
     def last_namestudent_type(self):
             return self.__lastnamestudent_type
    

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, "International")
 
        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?

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?

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, type):
         self.__id = id
         self.__firstname = firstname
         self.__lastname = lastname
         self.__type = type
    
    
     @property
     def iden(self):
         return self.__id
    
     @property
     def first_name(self):
         return self.__firstname
    
     @property
     def last_name(self):
         return self.__lastname
    
     @property
     def student_type(self):
         return self.student_type
    

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, "International")

        self.__documents = deepcopy(docuemnts)

    @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, "Domestic")

Have I constructed and implementation the abstract class correctly?

Fixed indentation
Source Link
Grajdeanu Alex
  • 9.3k
  • 4
  • 32
  • 71

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?

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?

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?

added 1 character in body
Source Link
user150904
user150904
Loading
Source Link
user150904
user150904
Loading