I am making a website where Doctors and Patient both can login.
class Doctors {
    String firstName
    String lastName
    String email
    String password
    String hospitalName
    String NPINumber
}
And patients
class Patients{
    String firstName
    String lastName
    String email
    String password
}
As it is evident that there are lot of overlapping fields which are only used for authetication/login purpose, I was wondering if inheritance is a good idea or should I just create a flag in a single class.
So two options are:
OPTION-1
class Users{
    String firstName
    String lastName
    String email
    String password
}
class Doctors extends Users {
    String hospitalName
    String NPINumber
}
class Patients extends Users{
}
OPTION-2
class Users{
    String firstName
    String lastName
    String email
    String password
    boolean isDoctor
    String NPINumber
    String hospitalName
}
I am not sure which of these designs I should choose so that it is extendable in future!
 
     
    