ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is sealed class in c#?

user-image
تم إضافة السؤال من قبل Mohannad Bakbouk , Full Stack Web Developer , Almohtaseb
تاريخ النشر: 2016/10/20
Pathan Zarrar Khadar Khan
من قبل Pathan Zarrar Khadar Khan , Windows System Administrator , Dyce Tech Pvt Ltd

Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as a sealed class, the class cannot be inherited. In C#, the sealed modifier is used to define a class as sealed

Zeeshan Amjad
من قبل Zeeshan Amjad , CTO

You can not inherit class form the seal class. If you know the Java then it is similar to "final class" in Java. Here is MDSN page for few examples. 

https://msdn.microsoft.com/en-us/library/88c54tsw.aspx

Shahid Riaz Qureshi
من قبل Shahid Riaz Qureshi , Senior Software Engineer , Royal IHC

A class that cannot be inherited in order to protect it's functionality.

Muhammad Ali
من قبل Muhammad Ali , Senior Software Engineer , TPS Pakistan

A sealed class is the one which can not be inherited by other classes.A class can be declared as sealed by using the keyword "sealed" in class declaration.

Bineesh VP
من قبل Bineesh VP , Software Developer , Unknown

Seales class is the feature of OOP . A class cannot be inherited from outside scope.

sonal winston
من قبل sonal winston

sealed class is used to the define inheritance level of a class.sealed classes are used to restrict the inheritance feature in object oriented .it can be derived but it is not a base class .once a class is defined as a sealed class it cannot be inherited.

Javad Ahmadzadeh
من قبل Javad Ahmadzadeh , Web Developer – Android Developer , Donyay-e Pardazesh-e Abri

When we define a class with "sealed" modifier, we cannot inherit it. It's equivalent to NonInheritable on VB.NET

Shahid Malik
من قبل Shahid Malik , Senior Software Engineer , Capgemini India

Class is declared as Sealed in order to prevent it from being Inherited.

Nauman Zafar
من قبل Nauman Zafar , Senior Software Engineer , Polymer DLP

C# offers a sealed keyword for protecting classes to be inherited. Why use Sealed classes ? You are implementing some security features using that particular class and don't want the object to be manipulated. Secondly, sealed keyword is an indication to Common Language Runtime (CLR) that there are no sub-classes to look down which further increases overall performance if properly used.

Ziauddin Zia
من قبل Ziauddin Zia , Software Engineer , Asia Poultry Feeds (Pvt) Ltd

Sealed, as is name indicates lock the class from inheritance.

So simple is that sealed classes cannot be inherited.

Ubaid sayeed Mohd abdul sayeed
من قبل Ubaid sayeed Mohd abdul sayeed , Senior Programmer , Moksha solutions

restrict the inheritance feature of object oriented programming.