Possible Duplicate:
When should you use a class vs a struct in C++?
When, if ever, should one use a STRUCT declaration rather than a CLASS declaration when writing a program using C++?
- Never !! ?
- Any thing…whichever makes one feel better?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only difference between the two is that by default
structare public whileclassmembers are private.My rule is to use
structwhen I mean a clump of related data without any special semantics on reading/writing them. Useclasswhen I intend to wrap the data in richer semantics (read methods) that are more meaningful, provide any needed protection, or implement something more abstract.