Who will take the role of Friend functions in java as in C++? How will it work in java ?
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 closest thing Java has to C++ friends is the default access modifier, also known as package-protected or package-private. This allows access to members only from other classes within the same package.
This is also the best reason to place classes in the same package, rather than grouping into subpackages based on functionality.