---
title: "What are the types of classes in C#?"  
description: "What are the types of classes in C#?"  
author: "Mukul Goenka"  
published: 2021-11-09  
updated: 2023-06-06  
canonical: https://www.mindstick.com/interview/33810/what-are-the-types-of-classes-in-c-sharp  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 3 minutes  

---

# What are the types of classes in C#?

What are the types of classes in C#?

## Answers

### Answer by Aryan Kumar

There are five types of classes in C#:

1. **Static classes:** A static class is a class that does not have any instance members. This means that there are no objects that can be created from a static class. Static classes are typically used to contain utility methods or constants.
2. **Abstract classes:** An abstract class is a class that cannot be instantiated directly. Instead, it must be inherited from by another class. Abstract classes can contain both abstract and non-abstract methods. Abstract methods are methods that do not have a body and must be implemented by the inheriting class. Non-abstract methods can have a body and can be used by both the abstract class and the inheriting class.
3. **Partial classes:** A partial class is a class that can be split into two or more parts. The parts can be written in different files and compiled separately. Partial classes are typically used to break up large classes into more manageable pieces.
4. **Sealed classes:** A sealed class is a class that cannot be inherited from. This is used to prevent the class from being extended in unexpected ways.
5. **Interfaces:** An interface is a contract that defines a set of methods that must be implemented by a class. Interfaces cannot contain any data members. This means that interfaces cannot store any data. Interfaces can only contain methods. Methods in an interface are always abstract. This means that they do not have a body and must be implemented by the class that implements the interface.

The type of class that you use will depend on the specific needs of your program. For example, if you need a class that can be instantiated, you will use a non-abstract class. If you need a class that cannot be instantiated, you will use an abstract class or a sealed class. If you need a class that can be split into multiple parts, you will use a partial class. If you need a class that can be used to define a set of methods, you will use an interface.

### Answer by Ravi Vishwakarma

**Class** is an entity that encapsulates all the properties of its objects and instances as a single unit for accessing the variables of its class.

C# has 4 types of classes.

**Static class:** Static class, defined by the keyword ‘static’ does not allow inheritance. Therefore, you cannot create an object for a static class.

**Partial class:** Partial class, defined by the keyword ‘partial’ allows its members to partially divide or share source files.

**Abstract class:** Abstract classes are classes that cannot be instantiated where you cannot create objects. Abstract classes work on the OOPS concept of abstraction. Abstraction helps to extract essential details and hide the unessential ones.

**Sealed class:** Sealed class cannot be inherited. Use the keyword sealed for making the sealed class.

### Answer by Mukul Goenka

What are the types of classes in C#?


---

Original Source: https://www.mindstick.com/interview/33810/what-are-the-types-of-classes-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
