Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3307626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:25:41+00:00 2026-05-17T21:25:41+00:00

5-6 years ago when i was in school, I had C as my programming

  • 0

5-6 years ago when i was in school, I had C as my programming language. And at that time, I read about struct and little bit about Classes.

At that time I had a concept that under struct we cannot declare functions and other such things.

Structure only allows value types and themself are also value types. And I was living under that same old age concepts.
3 days earlier when I had some conversation with my collegues they proved that struct can also contain function definations, constuctors any many more things against my thinking of

public struct  abc
{
   int a;
   long b;
    .... //No function nothing else can come here. Only variables
};

But in .net I saw DateTime Struct and it had functions constructors and everything against my years old concepts.

Then what makes difference between classes and struct if every thing can be done in struct.

I am sure there would be some big differences, due to which struct are still coming with .net rather than obsoleting it.

What are those differences.

And what other such concepts could a one have that changed everything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:25:41+00:00Added an answer on May 17, 2026 at 9:25 pm

    As far as I can tell you are asking what are the differences between structs and classes in C#.

    The key difference is that structs behave following value type semantics, classes behave according to reference type semantics.

    • Value types directly store a value in a memory location. If you copy a struct, the value gets copied, you now have two values stored in two separate memory locations.
    • Reference types store a value in a memory location and a pointer (or reference) to that memory location. If you copy a class the reference gets copied, but the data remains the same. You now have two references pointing to the same memory location.

    Aside from that there are some minor restrictions on what you can put in a struct (such as no parameterless constructors and only interface inheritance), but that isn’t what’s important. These restrictions are fairly irrelevant really, you shouldn’t choose to use a struct just to prevent inheritance. What matters is the how the type behaves semantically and that is what you should focus on when choosing between a struct and a class.

    Further information:
    This question has some good answers that explain the difference in more detail.
    The MSDN page on structs has some good information on the restrictions.
    Eric Lippart has an interesting two part blog post (part1, part2) on the details of struct vs class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I went to school for programming years ago and when I got out I
A few years ago, I read a book that described how you could override
A couple of years ago, my school had a software solution from Novell. Just
Years ago I released a program called Banshee Screamer Alarm and at the time
Some years ago I was told about a study into code reuse. Apparently it
I haven't used Access since high school, years ago. What kind of problem does
Some years ago, I was taught that JavaScript code blocks embedded inside HTML should
Some years ago I built an Excel file for my colleagues that displays lots
10 years ago I did some game programming and used OpenGL for the 3d
Years ago when I was working with C# I could easily create a temporary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.