According to others, private members are inherited. Membership is another subject, but not completely unrelated to inheritance. It is important to understand that all members are inherited regardless of their access modifier, since it affects the size of subclasses. Consider the following code.
public class Foo { private int a; public int b; } public class Bar : Foo { private int c; public int d; }
Foo will consume 16 bytes on the heap. 4 for synchronization, 4 for type information (method table) and 4 for int variables for a total of 12. Bar , on the other hand, will consume 24 bytes. 4 for synchronization, 4 for type information (method table), 4 for int fields inherited from Foo , and 4 for int fields in Bar for a total of 24.
Brian Gideon Jun 01 '10 at 15:43 2010-06-01 15:43
source share