static void Main(string[] args) { Export obj = new ExportToPdf(); // Export to pdf can be substituted obj.Convert(@"c:\demo.txt"); Export obj1 = new ExportToExcel(); // Export to Excel can be substituted obj1.Convert(@"c:\demo.txt"); }