Is the C++ public keyword exactly equivalent to internal keyword in C#?
As far as I understand, public in C++ means “can be used everywhere within the compilation unit”.
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, it’s not exactly equivalent. For starters, a C++ “compilation unit” isn’t equivalent to a .NET assembly.
Next, in C++ there is an additional concept, “linkage”, which determines whether a type can be used outside the compilation unit. Whether the same header file is included in other compilation units also affects visibility.