What is a Struct? How do I use this vs classes?

Structs are almost exactly the same except they don’t do inheritance. So we can’t create sub-categories inside a struct like we could a class.

Structs are a value type — value types are stored on the stack

int age = 25; — this is a value type, the value is stored directly in this line.

bool type = true; this is a value type

string name = “name” ;— this is a value type

You can change the original value of this.

Class are a reference type — reference types are stored on the heap

string myName = “Jonathan”; — this is stored into memory on a certain address on RAM.

You cannot change the original value type — only create a copy