access modifier

hi all, recently im learning about inheritance, i have a question about access modifier...
How do i initialize or get a data from a private access modifier class?
Example code:
1
2
3
4
5
6
7
8
9
class Base{
int x;
public:
 Base(int a):x(a){}
};

class Derive:Private Base{
//How i get or initialize x? since everything in Base class is private?
};


What i want to know is what is the usefulness of private access modifier? or When we gonna use it and HOW?
You do it through public functions in Base class. In this case, the constructor.
Topic archived. No new replies allowed.