---
title: "What are sealed classes in C#?"  
description: "What are sealed classes in C#?"  
author: "Anonymous User"  
published: 2018-03-18  
updated: 2020-09-19  
canonical: https://www.mindstick.com/interview/23357/what-are-sealed-classes-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# What are sealed classes in C#?

We create sealed class when we want to restrict or prevent the class to be inherited. Sealed modifier is used to prevent derivation from a class. If we try to specify a sealed class as base class then a compile-time error occurs.

## If we try to inherit sealed class then following error well be occure

class MyDerivedC: SealedClass {} // Error

The result is an error message:

'MyDerivedC' cannot inherit from sealed class 'SealedClass'.

## Answers

### Answer by Anonymous User

We create sealed class when we want to restrict or prevent the class to be inherited. Sealed modifier is used to prevent derivation from a class. If we try to specify a sealed class as base class then a compile-time error occurs.

## If we try to inherit sealed class then following error well be occure

class MyDerivedC: SealedClass {} // Error

The result is an error message:

'MyDerivedC' cannot inherit from sealed class 'SealedClass'.


---

Original Source: https://www.mindstick.com/interview/23357/what-are-sealed-classes-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
