public static void Main() { DC b = new TC(); b.Display(); b.Display(); b.Display(); b.Display(); Console.ReadLine(); }
public static void Main(string[] args) { var topLevelClass = new MyTopLevelClass(); Console.WriteLine("As Base Class: " + ((MyBaseClass)topLevelClass).ToString()); Console.WriteLine("As Derived Class:" + ((MyDerivedClass)topLevelClass).ToString()); Console.WriteLine("As Top Level Class: " + topLevelClass); Console.WriteLine("Base Class Valid Length: " + MyBaseClass.ValidLength); Console.WriteLine("Derived Class Valid Length:" + MyDerivedClass.ValidLength); Console.WriteLine("Top Level Class Valid Length: " + MyTopLevelClass.ValidLength); Console.WriteLine("As Base Class: " + ((MyBaseClass)topLevelClass).IsValid); Console.WriteLine("As Derived Class:" + ((MyDerivedClass)topLevelClass).IsValid); Console.WriteLine("As Top Level Class: " + topLevelClass.IsValid); topLevelClass.Noodle(); TC obj = new TC(); obj.Display(); var fivesie = new Fivesie(); fivesie.TheMethod(); ((Onesie)fivesie).TheMethod(); }
static void Main() { Console.WriteLine("Overloading"); Foo(105); Foo(18039932103); //Overriding Console.WriteLine(""); Console.WriteLine("Overriding"); BC b; b = new BC(); b.Display(); b = new DC(); b.Display(); b = new TC(); b.Display(); Console.Read(); }