static void Main(string[] args) { Console.WriteLine("-- Document Reader - PDF doc. --"); //create an instance of a DocumentReader. //pdf version. DocumentReader drpdf = new PDFDocument(); drpdf.OpenDocument(); //will "open" the pdf. //create a rtf version: DocumentReader drrtf = new RTFDocument(); drrtf.OpenDocument(); //will "open" the rtf. Console.ReadLine(); //Prof never says so, but I'm picking up that a lot of these patterns //can be used in place of if/else or case statements. //IE, instead of "if pdf then..." and "else..." //it's like each option goes in its own inheriting class. //it makes encapulation and simple and testing easier. //I'm also picking up that we might not need all of these fancy names. //Many of these "patterns" are just inheritance of some sort, //but slightly different as applied to different situations. }
static void Main(string[] args) { Console.WriteLine("---- Document Reader - PDF doc ----"); DocumentReader documenteReader = new PDFDocument(); documenteReader.OpenDocument(); Console.WriteLine("---- Document Reader - RTF doc ----"); documenteReader = new RTFDocument(); documenteReader.OpenDocument(); Console.ReadKey(); }