educative.io

Educative

Adding a type to the Account class makes it more generic do you agree?

    class AccountType(Enum):
           SAVING,CHECKING = 1,2

     class Account:
       def __init__(self, account_number, type):
          self.__account_number = account_number
          self.__total_balance = 0.0
          self.__available_balance = 0.0
          self.__account_type = type

       def get_available_balance(self):
          return self.__available_balance

    class SavingAccount(Account):
       def __init__(self, withdraw_limit, account_number):
          self.__withdraw_limit = withdraw_limit
          super().__init__(account_number, AccountType.SAVING)

    class CheckingAccount(Account):
       def __init__(self, debit_card_number, account_number):
          self.__debit_card_number = debit_card_number
          super().__init__(account_number, AccountType.CHECKING)

I add AccountType Enum Class and modify the init function on child classes
@Design_Gurus Please check this out and let me know if it is wrong to have it like this?

Thanks