Introduction

As we know, C# is an Object Oriented Programming language that provides the ability to reuse existing code. To reuse existing code, C# provides various object-oriented concepts such as classes, objects, properties, methods, structs, and records.

Now in this article, we learn about the overview of classes that are part of C# Object Oriented Programming concepts, and in the next article, we learn in detail about each class in depth. Let us start with defining the class.

What is a class in C#?

Classes are user-defined data types that represent the state and behavior of an object. The state represents the properties, and behavior is the action that objects can perform.

Classes can be declared using the following access specifiers that limit the accessibility of classes to other classes. However, some classes do not require any access modifiers.

  1. Public
  2. Private
  3. Protected
  4. Internal
  5. Protected internal

To learn the details of access specifiers, check out Access Modifiers in C#.

For example

public class Accounts
{

}

Some Key points about classes:

Types of classes in C#

What is an Abstract Class in C#?

An abstract class is a class that provides a common definition to the subclasses, and this is the type of class whose object is not created.

Some key points of Abstract classes are:

For example

abstract class Accounts
{

}

Continue here: Abstract Classes In C# (c-sharpcorner.com)

What are Partial Classes in C#

It is a type of class that allows dividing their properties, methods, and events into multiple source files, and at compile time, these files are combined into a single class.

The following are some key points:

For example

partial class Accounts

{

}

Continue here: Partial Classes in C#(c-sharpcorner.com)

What is Sealed Class in C#?

A Sealed class is a class that cannot be inherited and used to restrict the properties.

The following are some key points:

For example

sealed class Accounts

{

}

Continue reading: Sealed Class in C# (c-sharpcorner.com).

What is Static Class in C#?

It is the type of class that cannot be instantiated. In other words, we cannot create an object of that class using the new keyword, such that class members can be called directly using their name.

The following are some key points:

For example

static class Accounts

{

}

Continue reading Static Class In C# (c-sharpcorner.com).

Summary

I hope you have learned an overview of various types of classes in C#. In the next article, we will learn each class in C#.