public static void InvokeMemberOnINonAdminPublicSectorWorkerInterface(INonAdminPublicSectorWorker inon, string fileName) { try { inon.Load(fileName); } catch { } }
public static void INonAdminPublicSectorWorker(INonAdminPublicSectorWorker inon, string fileName) { try { inon.Load(fileName); } catch { } }
static void Main(string[] args) { INonAdminPublicSectorWorker hw = new HospitalWorker(); hw.Load("C:\\agenda.txt"); InvocationClass.INonAdminPublicSectorWorker(hw, "C:\\agenda.txt"); HospitalWorker h = new HospitalWorker(); Console.WriteLine(h.WastedTime()); ILazyWorker ilw = (ILazyWorker)h; INonAdminPublicSectorWorker inaps2 = (INonAdminPublicSectorWorker)ilw; Console.WriteLine(ilw.WastedTime()); Console.WriteLine(inaps2.GetItem(DateTime.Now)); }
static void Main(string[] args) { // // TODO: Add code to start application here // Example1 example1 = new Example1(); Console.WriteLine("Class type instance is {0} and derives from {1}", example1.GetType().Name, example1.GetType().BaseType); Example2 example2 = new Example2(); Console.WriteLine("Class type instance is {0} and derives from {1}", example2.GetType().Name, example2.GetType().BaseType); Example3 example3 = new Example3(); Console.WriteLine("Class type instance is {0} and derives from {1}", example3.GetType().Name, example3.GetType().BaseType); Console.WriteLine(example1); Console.WriteLine(example2); Teacher st = new SupplyTeacher(54); Console.WriteLine(st.GetCountryCode()); StaffTeacher staff = new StaffTeacher(54); Console.WriteLine(staff.GetCountryCode("UK")); string teacherString = String.Empty; InvocationClass.InvokeMemberOnTeacher(st, out teacherString); INonAdminPublicSectorWorker hw = new HospitalWorker(); hw.Load("C:\\agenda.txt"); InvocationClass.InvokeMemberOnINonAdminPublicSectorWorkerInterface(hw, "C:\\agenda.txt"); HospitalWorker h = new HospitalWorker(); Console.WriteLine(h.WastedTime()); ILazyWorker ilw = (ILazyWorker)h; INonAdminPublicSectorWorker inaps2 = (INonAdminPublicSectorWorker)ilw; Console.WriteLine(inaps2.GetItem(DateTime.Now)); Console.WriteLine(ilw.WastedTime()); }