Exemple #1
0
        static void Main(string[] args)
        {
            IHuman   h;
            Theodore t;

            h      = new Theodore();
            t      = (Theodore)h;
            t.Name = "Fred";
            t.Speak("I like public implementations!");
            h.Name = "Teddy";
            h.Speak("I like VB!");
        }
        static void Main(string[] args)
        {
            IHuman   h;
            Theodore t;

            h = new Theodore();
            //cast for assignement
            t = (Theodore)h;
            //use class based reference
            t.Name = "Fred";
            t.Speak("I like public implementations!");
            //use interface reference
            h.Name = "Tin";
            h.Speak("Tin Bile <3");
            Console.ReadLine();
        }