Hi, i am preparing for SCJP 5. I need advice regarding using interface and abstract in a particular scnario. Suppose there are three entities teacher, student, and admin. An teacher CAN be admin (giving out usernames and password) OR an admin CAN BE student (taking some course). How can we design this using interface and abstract classes:
1) I can have an abstract class Person and both student and teacher extending it. But then how do i bring in admin role. If i make admin an interface and make teacher and student classes implement this interface, both student and teacher classes will have to provide implementation.
2) If i have interface admin as a parent and abstract class person implementing the interface that does not much sense because it is not necessary that both student and teacher will be admin.
3) The last option i can think of is simply using composition and make a separate class admin whose reference will be in student and teacher class. It can be set to null if they dont have this role. But i am not sure if this is a good design? In this example we do not need to store information regarding admin so i dont think we need a concrete class for admin.