What is the java "package private" equivalent in C++ ? Java package privacy feature (where only classes within same package has visibility) is useful when providing APIs.
is there a similar feature for C++ (other than declaring other classes as "friend"s) ? to elaborate more, e.g. assume A.h and B.h are in same package (i.e. API lib) File : A.h
class A
{
public :
void doA();
private :
int m_valueA;
};
File : B.h
class B
{
public :
void doB()
private:
int m_valueB;
}
What I want is,
public visibility : ONLY A::doA() and B::doB()
within package(i.e. API lib) : A should be able to access B::m_valueB and B should be able to access A::m_valueA. WITHOUT making each other "friend" classes.