private static DocumentWorker CreateWorker() { DocumentWorker docWorker; WorkerType worker = DefineWorker(); int Key = 0; if (worker != WorkerType.Base) { Key = DefineKey(); } if ((worker == WorkerType.Pro) && (Key != 0)) // Pro worker with defined key { docWorker = new ProDocumentWorker(Key); } else if ((worker == WorkerType.Expert) && (Key != 0)) // Expert worker with defined key { docWorker = new ExpertDocumentWorker(Key); } else { docWorker = new DocumentWorker(); // Base worker definition } return(docWorker); }
static void Main(string[] args) { DocumentWorker docWorker = CreateWorker(); docWorker.Show(); Console.ReadLine(); }