Home > DeveloperSection > Forums > What is difference between class and structure?
Jonas Stuart
Jonas Stuart

Total Post:11

Points:77
Posted on    September-17-2016 7:09 AM

 C# C# 
Ratings:


 1 Reply(s)
 418  View(s)
Rate this:
Hi buddy

I am beginner in c# .Can you tell me about difference between class and structure.I appreciate your help.

Thanks



Abhishek Srivasatava
Abhishek Srivasatava

Total Post:24

Points:168
Posted on    September-17-2016 7:17 AM

Hi Jonas ,

Below are the points to specify the difference between the class and Structure:


Structure is not referenced type, but it is a value type. where as class is a reference type 
Reference type means that memory is allocated only when the object is created.

Value type means memory is allocated when declaration is done means hold the values in the memory at the time of declaration.

Structure is declare by using Keyword as Struct.

The structure does not support Inheritance.

The structure does not have destructor.

The structure does not have a default constructor.

A structure can implement one or more than one interface.

Structure members cannot be specified as abstract, virtual, or protected.


Thanks



Modified On Sep-18-2016 10:44:23 PM

Don't want to miss updates? Please click the below button!

Follow MindStick