Sealed classes restrict users from using inheritance, preventing the user from inheriting another class from it.
Sealed classes are defined using the sealed keyword. Given the inheritance attribute has been taken away, sealed classes work best when used with a class containing static members.
Syntax of Sealed class:
sealed class class_name
// data members
A partial class allows users to split the functionality of a class across the same file or even multiple files. During compilation, all instances are combined and treated as one.
Partial classes are defined using the partial keyword. Splitting a class allows multiple developers to work with the same class simultaneously. However, keep in mind that if any instance of the class is declared - sealed, abstract, or base - the whole class is declared with the same type.
Syntax of Partial class:
public partial Clas_name
: Commonly asked C# interview question