I am developing a application for sports clubs administraion. And my problem is that I have one primary class Member which contains all the “default” information (name, surname, gender…) and two other classes Coach and Practitioner which inherit from Member. A coach has some specific properties (salary, trainings held in current month…) wheres a practitioner has some others (isCompetitor, category …)
The problem is that a Practitoner can also be a Trainer as well as the other way around. How can I model this into something that is better then having two entries for the same person?
Edit: this is how it looks now
Class Member {}
Class Coach:Member {}
Class Practitioner:Member {}
If you’re only looking at them in one way at a time – so as one of a group of practitioners, or as one of a group of trainers – then you can create them as the specific type of member they are being viewed as at a time. If required, you can add a boolean property “IsTrainer” to practitioner and “IsPractitioner” to trainer, to indicate that there is more info about that person elsewhere.
This presumes you’re only looking at them in one way at a time, and not getting a page with all info about the person.