public static void Demo() { Helpers.DisplaySectionTitle("Sealed"); BaseClass parent = new BaseClass(); parent.Method1(); parent.Method2(); ChildA childA = new ChildA(); childA.Method1(); childA.Method2(); ChildB childB = new ChildB(); childB.Method1(); childB.Method2(); // ChildA.Method2() will be shown since it cannot be further overriden Helpers.DisplaySectionEnd(); }
public static void Demo() { Console.WriteLine($"Sealed"); Console.WriteLine(); BaseClass parent = new BaseClass(); parent.Method1(); parent.Method2(); ChildA childA = new ChildA(); childA.Method1(); childA.Method2(); ChildB childB = new ChildB(); childB.Method1(); childB.Method2(); // ChildA.Method2() will be shown since it cannot be further overriden Console.WriteLine($"------------------------"); Console.WriteLine(); }