Hi, I have a base class called Schedule and three classes inherited: DailySchedule, WeeklySchedule, MontlySchedule.
Now I would like to build a form in which users can modify the schedule and I have to compile different parts of it depending on whether the schedule is daily, weekly or montly. Then I want to have back the schedule modified.
Which object can I use on the form?
I thought to implement on the base class an interface iSchedule and to pass the interface to the form, but when I'm on the form constructor how can I cast the interface to the correct class? eg. in the form constructor I will have a sched variable as iSchedule, I can see that, for example, is a DailySchedule from an interface property called Type. But how can I cast the interface to an instance of the DailySchedule class and to access to its members?
I hope I was clear in exposing my question
Now I would like to build a form in which users can modify the schedule and I have to compile different parts of it depending on whether the schedule is daily, weekly or montly. Then I want to have back the schedule modified.
Which object can I use on the form?
I thought to implement on the base class an interface iSchedule and to pass the interface to the form, but when I'm on the form constructor how can I cast the interface to the correct class? eg. in the form constructor I will have a sched variable as iSchedule, I can see that, for example, is a DailySchedule from an interface property called Type. But how can I cast the interface to an instance of the DailySchedule class and to access to its members?
I hope I was clear in exposing my question