they’re very similar. In theory, the main difference is data encapsulation: a class offers private members and methods, whereas a struct doesn’t. In practice, that matters less than the “convention” (if you can call it that) of using a struct for little groups of data, as opposed to class which do things. Structs, more often than not, don’t have any methods besides a constructor and just kind of hold data while it’s passed around.
In C++ structs could also be private, the difference is that by default a member of a class would be private, and in a struct it would be public. But if you used the “private:” keyword in a struct, they would be private.
In C++ class vs. struct is just syntax sugar. Basically, these two are exactly the same:
class One {
public:
// foo
};
struct One {
};
Similarly if you’d write private specifier in a struct. It’s just the default access mode that is different.
In C# it’s different, classes are allocated on the heap and passed by reference; whereas structs are allocated inline (think on the stack for local variables etc.) and are passed by value.
C++ only kept structs to keep compatibility with C structs.
A class is not a script, it’s basically a user-defined data type. Usually you only have one class in per source file though. Also, I’m not sure why, but in C# (just when used with Unity) the script name has to be the same as the class name…