public static void CallDelegateFromSealedGrandChild() { SealedGrandChild child = new SealedGrandChild(); Assert.AreEqual("Child.AbstractFinal", new TestMethod(child.AbstractFinal)); Assert.AreEqual("GrandChild.AbstractOverrideFinal", new TestMethod(child.AbstractOverrideFinal)); Assert.AreEqual("Child.AbstractOverrideNil", new TestMethod(child.AbstractOverrideNil)); Assert.AreEqual("GrandChild.AbstractOverrideOverride", new TestMethod(child.AbstractOverrideOverride)); Assert.AreEqual("Child.VirtualFinal", new TestMethod(child.VirtualFinal)); Assert.AreEqual("GrandChild.VirtualNilFinal", new TestMethod(child.VirtualNilFinal)); Assert.AreEqual("Base.VirtualNilNil", new TestMethod(child.VirtualNilNil)); Assert.AreEqual("GrandChild.VirtualNilOverride", new TestMethod(child.VirtualNilOverride)); Assert.AreEqual("GrandChild.VirtualOverrideFinal", new TestMethod(child.VirtualOverrideFinal)); Assert.AreEqual("Child.VirtualOverrideNil", new TestMethod(child.VirtualOverrideNil)); Assert.AreEqual("GrandChild.VirtualOverrideOverride", new TestMethod(child.VirtualOverrideOverride)); }
public static void CallSealedGrandChild() { Console.WriteLine("Call SealedGrandChild from outside"); // Calling methods of a sealed class from outside SealedGrandChild o = new SealedGrandChild(); Assert.AreEqual("Child.AbstractFinal", o.AbstractFinal <object>()); Assert.AreEqual("GrandChild.AbstractOverrideFinal", o.AbstractOverrideFinal <object>()); Assert.AreEqual("GrandChild.AbstractOverrideOverride", o.AbstractOverrideOverride <object>()); Assert.AreEqual("Child.AbstractOverrideNil", o.AbstractOverrideNil <object>()); Assert.AreEqual("Child.VirtualFinal", o.VirtualFinal <object>()); Assert.AreEqual("GrandChild.VirtualNilFinal", o.VirtualNilFinal <object>()); Assert.AreEqual("GrandChild.VirtualOverrideFinal", o.VirtualOverrideFinal <object>()); Assert.AreEqual("GrandChild.VirtualNilOverride", o.VirtualNilOverride <object>()); Assert.AreEqual("Base.VirtualNilNil", o.VirtualNilNil <object>()); Assert.AreEqual("GrandChild.VirtualOverrideOverride", o.VirtualOverrideOverride <object>()); Assert.AreEqual("Child.VirtualOverrideNil", o.VirtualOverrideNil <object>()); }
public static void CallSealedGrandChild() { Console.WriteLine("Call SealedGrandChild from outside"); // Calling methods of a sealed class from outside SealedGrandChild o = new SealedGrandChild(); Assert.AreEqual("Child.AbstractFinal", o.AbstractFinal()); Assert.AreEqual("GrandChild.AbstractOverrideFinal", o.AbstractOverrideFinal()); Assert.AreEqual("GrandChild.AbstractOverrideOverride", o.AbstractOverrideOverride()); Assert.AreEqual("Child.AbstractOverrideNil", o.AbstractOverrideNil()); Assert.AreEqual("Child.VirtualFinal", o.VirtualFinal()); Assert.AreEqual("GrandChild.VirtualNilFinal", o.VirtualNilFinal()); Assert.AreEqual("GrandChild.VirtualOverrideFinal", o.VirtualOverrideFinal()); Assert.AreEqual("GrandChild.VirtualNilOverride", o.VirtualNilOverride()); Assert.AreEqual("Base.VirtualNilNil", o.VirtualNilNil()); Assert.AreEqual("GrandChild.VirtualOverrideOverride", o.VirtualOverrideOverride()); Assert.AreEqual("Child.VirtualOverrideNil", o.VirtualOverrideNil()); }