Interviews - C# Corner

Ravi Patel
what is Sealed class
By Ravi Patel in .NET onNov 21 2018
  • Sandhya Pothineni
    Dec, 2018 20

    Sealed class is nothing but final class. we can instantiate the sealed class but can't inherit sealed class.

    • 10
  • Sneha Reddy
    Dec, 2018 20

    Sealed keyword is used to restrict the inheritance, if we make a class sealed that means it can only be instantiated.

    • 6
  • Saikrishna Nangunuri
    Dec, 2018 20

    a sealed class is same as a final class. 1.we cannot inherit sealed class. 2.we can instantiate the sealed class.

    • 4
  • Mehul Rudatala
    Nov, 2019 25

    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.

    1. using System;
    2. public class Program
    3. {
    4. public static void Main()
    5. {
    6. ExampleCls example = new ExampleCls();
    7. example.num = 5;
    8. Console.WriteLine(example.num);
    9. Console.ReadLine();
    10. }
    11. }
    12. public sealed class ExampleCls
    13. {
    14. public int num { get; set; }
    15. public string data { get; set; }
    16. }
    17. //You can not use as base class like below
    18. public class ExampleCls2 : ExampleCls
    19. {
    20. public int num2 { get; set; }
    21. public string data2 { get; set; }
    22. }

    • 1
  • Anil Kumar
    Aug, 2019 3

    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

    • 1
  • Mahavirsinh Padhiyar
    May, 2019 10

    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).

    • 1
  • Kapil Gaur
    Apr, 2019 4

    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.

    • 1
  • Kalyani Shevale
    Dec, 2018 27

    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.

    • 1
  • Kalyani Shevale
    Dec, 2018 27

    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.

    • 1
  • Bhushan Bhasme
    Nov, 2018 29

    Sealed class are used to restrict the inheritance feature of oop.Once class is defined as sealed ,The class cant be inherrited.

    • 1
  • Sreekanth Reddy
    Nov, 2018 25

    A class which doesn't allows inheritance concept.

    • 1
  • Alan Moore
    Nov, 2018 24

    You can not inherit or extend a sealed class.

    • 1
  • Gaurav Gupta
    Apr, 2019 24

    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.

    • 0
  • Gajendra Jangid
    Mar, 2019 28

    If we want that no-one can inherit our class then we can use sealed class.

    • 0
  • Shivam
    Mar, 2019 16

    A class which can't be inherited further.

    • 0
  • Shivam
    Mar, 2019 16

    Which can't be inherited further.

    • 0
  • harikesh dubey
    Mar, 2019 7

    If you dont want someone inherit the class or restrict to inherit . sealed class helpful in this sceanrio.

    • 0
  • Md Sarfaraj
    Feb, 2019 18

    https://www.c-sharpcorner.com/article/sealed-class-in-C-Sharp/

    • 0
  • Saikumar Putta
    Jan, 2019 20

    1.)It's a final class 2.)A sealed class can be instantiate cannot inherited.its restricts inheritance

    • 0
  • Debasis Mohapatra
    Jan, 2019 17

    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.

    • 0
  • Abhinav Singh
    Dec, 2018 23

    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

    • 0
  • Yashwanth Pandi
    Dec, 2018 20

    Sealed class is the class which cant be inherit but can be instantiate.

    • 0
  • JAY SARANIYA
    Dec, 2018 12

    A sealed class is used to restrict the inheritance nothing else

    • 0
  • Bhavesh Ghul
    Dec, 2018 12

    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.

    • 0
  • Amol Bhillare
    Dec, 2018 1

    Sealed classes are used to restrict the inheritance feature of object oriented programming.

    • 0
  • Chetan Kams
    Nov, 2018 28

    the class which is sealed is aclled sealed class.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS