Difference between a structure and a class
- Structures are value type and Classes are reference type.
- Structures can not have constructors or destructors. Classes can have both constructors and destructors.
- Structures do not support Inheritance, while Classes support Inheritance.
- Classes are usually used for large amounts of data, whereas structs are usually
used for smaller amounts of data.
- A structure couldn't be null whereas a class can be null.
- A structure can't be abstract whereas a class can be abstract.
No comments:
Post a Comment