0
Difference between class and structure
I came from the knowledge of C. Now that I am learning about Classes in C#, they just look the same as a structure in C. Are they the same thing?
3 Antworten
+ 3
No they are not. Structs are primitive version of classes.
Class is from OOP terminology. You should learn about OOP to understand what classes are.
There are a lot of things that you probably won't understand without knowing what object oriented programming is.
The access to vars in struct are public default, but in class they are private.
+ 2
If you pass a class as an argument it is passed by reference, if you pass a struct as an argument it is passed by value.
+ 1
Simply structure is procedural language or structure Oriented language.
Whereas class is object oriented language.
The both are different. If you want to know about the classes and how they declare better to learn OOP's concept. Then you can simplify all this.