I have a super class: TriggerManager with a subclass TimedTriggerManager. NOTE: I'm working in java
TimedTriggerManager only deals with TimedTrigger s, a subclass of Trigger. TriggerManager references all Trigger objects. To modify the subclass (TimedTriggerManager) to only accept TimedTriggers into its accessors and mutators (getters and setters) I have the following questions:
1) I have in TriggerManager the following public void addTrigger(Trigger t). In TimedTriggerManager should I just override the method to throw an error if the argument (t) is not a TimedTrigger. If so, What error should I throw? If not, what should I do?
2) Should I add another method getTimedTrigger to work alongside the supper class's getTrigger so that I don't have to keep type casting? (Since the latter would return a Trigger object)
3) Is there anything else I'm forgetting, or some common practice that I'm not doing?