---
title: "What are similarities between a class and a structure."  
description: "What are similarities between a class and a structure."  
author: "Sumit Kesarwani"  
published: 2014-08-27  
updated: 2020-09-24  
canonical: https://www.mindstick.com/interview/2054/what-are-similarities-between-a-class-and-a-structure  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# What are similarities between a class and a structure.

Structures and classes are the two most important data structures that are used by programmers to build modular programs by using OOP languages, such as Visual Basic .NET, and Visual C#. The following are some of the similarities between a class and a structure:

Access specifiers, such as public, private, and protected, are identically used in structures and classes to restrict the access of their data and methods outside their body.

The access level for class members and struct members, including nested classes and structs, is private by default. Private nested types are not accessible from outside the containing type.

Both can have constructors, methods, properties, fields, constants, enumerations, events, and event handlers.

Both structures and classes can implement interfaces to use multiple-inheritance in code.

Both structures and classes can have constructors with parameter.

Both structures and classes can have delegates and events.

## Answers

### Answer by Sumit Kesarwani

Structures and classes are the two most important data structures that are used by programmers to build modular programs by using OOP languages, such as Visual Basic .NET, and Visual C#. The following are some of the similarities between a class and a structure:

Access specifiers, such as public, private, and protected, are identically used in structures and classes to restrict the access of their data and methods outside their body.

The access level for class members and struct members, including nested classes and structs, is private by default. Private nested types are not accessible from outside the containing type.

Both can have constructors, methods, properties, fields, constants, enumerations, events, and event handlers.

Both structures and classes can implement interfaces to use multiple-inheritance in code.

Both structures and classes can have constructors with parameter.

Both structures and classes can have delegates and events.


---

Original Source: https://www.mindstick.com/interview/2054/what-are-similarities-between-a-class-and-a-structure

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
