Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the equivalent of C++s “friend”?

equivalent friend
0
Posted

What is the equivalent of C++s “friend”?

0

The keyword “friend” in C++ is a hack to allow a piece of code to access the private member declarations of another class. In the Java programming language, you would do this by labelling, not the friend, but the private members. Instead of making them private, make them either protected or package (no keyword) or public. The four different protection levels are: private, package, protected, and public.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123