1. Classes are usually used for large amounts of data, whereas structs are usually used for smaller amount of data.
2. Classes could be inherited whereas structures no
3. A structure couldn't be Null like a class.
4. A structure couldn't have a destructor such as class.
5. A structure can't be abstract, a class can.
6. You can't use sizeof with classes but you can with structures.
7. The structure can't contain a volatile field wheatears the class does.
8. classes support polymorphism, whereas structures do not.
No comments:
Post a Comment