If a class is declared as Sealed we can not inherit the class the within the class and outside the class also.
Interviews27 answers
what is Sealed class
27 Answers
Aniket NarvankarPosted Mar 10, 2021, 9:14 AM EST
In simple things, Sealed means you can not use this class as a base class. You can create instance of this class and access properties and methods.
using System;public class Program{public static void Main(){ExampleCls example = new ExampleCls();example.num = 5;Console.WriteLine(example.num);Console.ReadLine();}}public sealed class ExampleCls{public int num { get; set; }public string data { get; set; }}//You can not use as base class like belowpublic class ExampleCls2 : ExampleCls{public int num2 { get; set; }public string data2 { get; set; }}
Mehul RudatalaPosted Nov 24, 2019, 8:13 PM EST
In C#.Net, The purpose of Sealed class is to restrict the Inheritance functionality of OOPS.
If we name a class as sealed class,it cannot be inherited.
Syntax: sealed class MyClass
Anil KumarPosted Aug 3, 2019, 2:42 AM EDT
Sealed class is such a class when it is used we can not inherit that class to any derived class. Sealed class can only useful when scenario comes to not allowing existing class inherit to other classes(last station of inherit that class).
Mahavirsinh PadhiyarPosted May 10, 2019, 2:38 AM EDT
If you want to restrict inheritance of any class make it with sealed keyword. when you define class as sealed that class can't inherit.
Gaurav GuptaPosted Apr 24, 2019, 10:45 AM EDT
We make a class Sealed if you do not want that particular class to be further inherited by any other class. This class can inherit from other classes but No class can inherit this Sealed Class. We can instantiate such classes but cannot inherit them further. Hope the concept is clear now.
Kapil GaurPosted Apr 4, 2019, 4:36 AM EDT
If we want that no-one can inherit our class then we can use sealed class.
Gajendra JangidPosted Mar 27, 2019, 9:21 PM EDT
A class which can't be inherited further.
ShivamPosted Mar 16, 2019, 12:59 PM EDT
Which can't be inherited further.
ShivamPosted Mar 16, 2019, 12:59 PM EDT
If you dont want someone inherit the class or restrict to inherit . sealed class helpful in this sceanrio.
harikesh dubeyPosted Mar 6, 2019, 10:37 PM EST
https://www.c-sharpcorner.com/article/sealed-class-in-C-Sharp/
Md SarfarajPosted Feb 18, 2019, 5:49 PM EST
1.)It's a final class
2.)A sealed class can be instantiate cannot inherited.its restricts inheritance
Saikumar PuttaPosted Jan 20, 2019, 1:53 AM EST
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. In C#, the sealed modifier is used to define a class as sealed.
Debasis MohapatraPosted Jan 17, 2019, 12:37 AM EST
C# sealed keyword applies restrictions on the class and method. If you create a sealed class, it cannot be derived. If you create a sealed method, it cannot be overridden.
Kalyani ShevalePosted Dec 26, 2018, 8:00 PM EST
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. In C#, the sealed modifier is used to define a class as sealed. In Visual Basic .NET, NotInheritable keyword serves the purpose of sealed.
Kalyani ShevalePosted Dec 26, 2018, 7:59 PM EST
You can not inherit class marked with Sealed keyword .If you mark function in base class with virtual keyword and override that function in derive class and you do not want that function to get override further in child class of derive then you mark function in derive class with sealed keyword
Abhinav SinghPosted Dec 23, 2018, 6:11 PM EST
Sealed keyword is used to restrict the inheritance, if we make a class sealed that means it can only be instantiated.
Sneha ReddyPosted Dec 19, 2018, 10:32 PM EST
Sealed class is nothing but final class. we can instantiate the sealed class but can't inherit sealed class.
Sandhya PothineniPosted Dec 19, 2018, 10:06 PM EST
Sealed class is the class which cant be inherit but can be instantiate.
Yashwanth PandiPosted Dec 19, 2018, 9:54 PM EST
a sealed class is same as a final class.
1.we cannot inherit sealed class.
2.we can instantiate the sealed class.
Saikrishna NangunuriPosted Dec 19, 2018, 9:49 PM EST
A sealed class is used to restrict the inheritance nothing else
JAY SARANIYAPosted Dec 12, 2018, 6:15 PM EST
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. In C#, the sealed modifier is used to define a class as sealed. In Visual Basic .NET, NotInheritable keyword serves the purpose of sealed.
Bhavesh GhulPosted Dec 12, 2018, 2:00 AM EST
Sealed classes are used to restrict the inheritance feature of object oriented programming.
Amol BhillarePosted Dec 1, 2018, 6:49 AM EST
Sealed class are used to restrict the inheritance feature of oop.Once class is defined as sealed ,The class cant be inherrited.
Bhushan BhasmePosted Nov 29, 2018, 1:22 AM EST
the class which is sealed is aclled sealed class.
Chetan KamsPosted Nov 27, 2018, 8:07 PM EST
A class which doesn't allows inheritance concept.
Sreekanth ReddyPosted Nov 25, 2018, 6:14 PM EST
You can not inherit or extend a sealed class.
Alan MoorePosted Nov 24, 2018, 8:43 AM EST











