As far as i know, there’re only 3 access-specifiers in C++: private, public, protected
With these 3 access-specifiers, how can i make a method usable to the classes in the project but unusable to the “foreigners” ??(like internal and public in C#)
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.
C++ does not know what a project is.
C++ knows about classes, where it offers the three access specifiers you mentioned.
C++ knows about translation units, where it offers two access specifiers: internal and external linkage.
Edit: About internal and external linkage, this is related to whether a symbol will be seen outside of the translation unit (the object file). Any global
staticorconstvariable defined in the TU has internal linkage. Others have external linkage.