class X
{
private:
int mine;
void myfunc(void);
public:
int ours;
void ourfunc(void);
};
X var;
After the definition of var, the rest of the program can access
the data member ours. However, only member functions of X
can access the data member mine. In other words, both member
functions myfunc and ourfunc can access both mine
and ours. myfunc can call ourfunc, and vice
versa.
However, other functions, including main, can
only access the public members, function ourfunc and
data member ours.