It's because the private members do exist in the memory, and are actually there with the class and they are only inaccessible to the derived class members and objects. The public base methods which are inherited WILL be able to access, modify the base members.
It could very well be that you are modifying the private members through the public methods of the class. For instance:
Code:
class B {
private:
int var;
public:
void modify_var(int v) {
var = v;
}
};
class A : public B {
private:
int num;
public:
void modify_A_var(int v, int n) {
[B] modify_var(v);[/B]
num = n;
}
};
You can see in modify_A_var() in class A is accessing a private member of class A only albeit through a member function of the base class.
P.S.: My C++ is rusty, not programmed for over a year, feel free to correct if my post is wrong or has errors.
P.P.S.: Best of luck for the exam