Is there a difference between:
struct B {...};
struct D : B {...};
and:
struct B {...};
struct D : public B {...};
If no, why everyone, including the standard, using more verbose, 2nd variant?
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.
No, the two are exactly the same. And I am not sure everyone uses the second variant. I don’t, for instance. Neither does the standard use it everywhere. For example, in C++11 §3.8, we see this:
On the other hand, being explicit means that people who don’t know the rules can understand the code.