In c++ if you create a struct or class like this
struct foo {
}
Must you use the struct or class qualifier to create another one as you do in c, if not why is that? When would it be appropriate to use it in C++
Example
struct foo a;
Thanks 🙂
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
structis not required. In C++, the only difference between astructand aclassis that in astruct, members arepublicby default, while in aclass, they’reprivateby default.