Example #1
0
        /* The internal access modifier will make a member of a type accessible within the assembly
         *  in which it is declared. This can be an exe or dll*/

        /* The readonly access modifier will make a member of a type read only. The value of the
         * member can only be set at declaration or within the constructor of the class.  */

        public static void TestInterface()
        {
            Report     myReport  = new Report();
            IPrintable printItem = myReport;

            printItem.GetPrintableText(1, 1);
        }
Example #2
0
        static void Main(string[] args)
        {
            Report myReport = new Report();

            IPrintable printItem = myReport;

            Console.WriteLine(printItem.GetTitle());
            Console.WriteLine(printItem.GetPrintableText(pageWidth: 80, pageHeight: 23));
            Console.ReadKey();
        }
Example #3
0
        private static void PrintingInterfaceExample()
        {
            Report myReport = new Report();

            /* Once the methods have been made explicit implementations of the interface, the only way
             * to access these methods in a Report instance is by a reference of a IPrintable type. */
            IPrintable printItem = myReport;

            Console.WriteLine(printItem.GetTitle());
            Console.WriteLine(printItem.GetPrintableText(80, 23));

            IDisplay displayItem = myReport;

            Console.WriteLine(displayItem.GetTitle());
        }
 public void PrintItem(IPrintable item)
 {
     Console.WriteLine(item.GetTitle());
     Console.WriteLine(item.GetPrintableText(pageWidth: 80, pageHeight: 25));
 }
Example #5
0
 public void PrintItem(IPrintable item)
 {
     Console.WriteLine(item.GetTitle());
     Console.WriteLine(item.GetPrintableText(80, 25));
 }