static void Main(string[] args) { DocumentWorker or = new DocumentWorker(); or.OpenDocument(); or.EditDocument(); or.SaveDocument(); Console.WriteLine(""); ProDocumentWorker pro = new ProDocumentWorker(); pro.OpenDocument(); pro.EditDocument(); pro.SaveDocument(); Console.WriteLine(""); ExpertDocumentWorker ex = new ExpertDocumentWorker(); ex.OpenDocument(); ex.EditDocument(); ex.SaveDocument(); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Введите ключ"); string key = Console.ReadLine(); DocumentWorker doc = null; switch (key) { case "prof": doc = new ProDocumentWorker(); break; case "expert": doc = new ExpertDocumentWorker(); break; default: Console.WriteLine("Ключ не верен"); doc = new DocumentWorker(); break; } doc.OpenDocument(); doc.EditDocument(); doc.SaveDocument(); Console.ReadKey(); }