public static void Main(string[] args) { var list = new List <Manuscript>(); var formatter = new ReverseFormatter(); var faq = new Faq(formatter) { Title = "Title" }; faq.Questions.Add("Question one", "Answer to question one"); faq.Questions.Add("Question two", "Answer to question two"); list.Add(faq); var book = new Book(formatter) { Title = "Title", Author = "Author", Text = "Text" }; list.Add(book); var termPaper = new TermPaper(formatter) { Class = "Class", Student = "John Oliver", Text = "Text" }; list.Add(termPaper); foreach (var l in list) { l.Print(); } Console.ReadKey(); }
public static void Main(string[] args) { var standardFormmater = new StandardFormatter(); var book = new Book(standardFormmater) { Title = "Book Title", Author = "Book Author", Text = "Book text ..." }; var termPaper = new TermPaper(standardFormmater) { Class = "Class Name", Student = "Student Name", Text = "Book text ...", References = "Paper References" }; Console.WriteLine("----------------STANDARD FORMMATER----------------------------"); book.Print(); termPaper.Print(); Console.WriteLine("----------------STANDARD FORMMATER----------------------------"); var reverseFormmater = new ReverseFormatter(); book.SetFormatter(reverseFormmater); book.Print(); termPaper.SetFormatter(reverseFormmater); termPaper.Print(); Console.ReadKey(); }