I have two classes: Teacher and Coordinator. Coordinator extends Teacher.
Basically I wanted to make an instance variable that could take in either a Teacher instance or Coordinator instance.
I know this is easily possible by just writing Teacher exp = new Teacher() or Teacher exp = new Coordinator(), however when I do this, I am only able to access Teacher methods and properties when I apply new Coordinator() or new Teacher() to the reference variable which is normal. My question is that is there another way where I only use one instance variable that can be assigned to Teacher OR Coordinator objects and use this variable to call any property/method of the object that was assigned to the object reference variable?
Coordinator?