1. public class B extends A { 2. private int bar; 3. public void setBar(int b) { 4. bar = b; 5. } 6. } 7. class A { 8. public int foo; 9. }
The question is whether class B is tightly encapsulated?? The correct answer is No. I agree that B extends A, but it does not use the public variable foo of A, then shouldnt it be tightly encapsulated???