I am curious as to how the concept of "inheritance" takes place in the world of object oriented programming. Let me explain my dilemma (I came across this dilemma while studying Java but I hope that my question is generic in nature) :

Suppose there is a class A and a class B. Class A **"inherits"** Class B. What does this actually mean? Does the compiler make a **"new"** class, which is *THEN* instantiated into an object which contains the elements of both the classes A and B behind the scenes? If that's the case, then how are the access restrictions implemented according to the access specifiers?

For a moment, I wondered if it happens in the following manner :

An object of class A is created and then an object of class B is created. Java then somehow "link" the members of A to the members of B and make it appear as if they belonged to the same class and it does that according to the access specifiers. 

But then, it occurred to me that there is a fault with this theory. Suppose two different classes, B and C are inheriting class A. Then, if we are going to make objects of class B and class C, then they'll have their OWN copies of the elements of class A. So this theory fails too.

I was just trying to explain the confusion about inheritance that I have in my mind. It's giving me headache. Please help.

EDIT : This is a link to a discussion related to my question which i found on this site. 

[Do subclasses inherit private fields?](https://stackoverflow.com/questions/4716040/does-subclasses-inherit-private-fields)