Pramod Patel
// cs_sealed_keyword.cs // Sealed classes using System; sealed class MyClass { public int x; public int y; } class MainClass { public static void Main() { MyClass mC = new MyClass(); mC.x = 110; mC.y = 150; Console.WriteLine("x = {0}, y = {1}", mC.x, mC.y); } }
x = 110, y = 150In the preceding example, if you attempt to inherit from the sealed class by using a statement like this:class MyDerivedC: MyClass {} // Erroryou will get the error message:'MyDerivedC' cannot inherit from sealed class 'MyBaseC'.