x = 100 ,y = 180
This is a C# Program to create sealed class.
This C# Program Creates Sealed Class.
Here sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as sealed class, this class cannot be inherited.
Here is source code of the C# Program to Create Sealed Class. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Create Sealed Class */ using System; sealed class SealedClass { public int x; public int y; } class SealedTest { static void Main() { SealedClass sc = new SealedClass(); sc.x = 100; sc.y = 180; Console.WriteLine("x = {0}, y = {1}", sc.x, sc.y); Console.ReadLine(); } }
In this C# program, we have already defined the values of ‘x’ and ‘y’ variable as 100 and 180 respectively. The sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as a sealed class, this class cannot be inherited.
x = 100 ,y = 180