Quote:
|
Originally Posted by balkman
Tell how they are different other than their default access type. Anything you can do with a class you can do with a structure.
|
Classes are passed through reference while structures are passed through value.
Classes are inherited privately by default. Structs are inherited publicly.
Structs by convention normally don't contain functions and are carried over from C. C didn't have classes. Structs are a C thing. Remember, no member functions or constructors in C.
The only way I would use a struct is if I were communicating with an old API, working with a legacy program or modeling a simple POD type.
I simply prefer using class. Afterall, the default access is not a negligable thing and the keyword class is much more fitting.