In C++, there’s little difference between
class defaults to “private” access and a
struct defaults to “public” access. There are no other technical differences between the two, though structs are often used for small and simple data types.
C# mimics the syntax of C++ to some degree and also provides
struct. However, in this case, the technical difference is quite large! In this post, I’ll briefly explain that difference and highlight a scenario where using a
struct saved a lot of memory on a project I worked on.