I am new to OOP and I have some doubts regarding encapsulation.
What is mean by difference between "partial" and "weak" encapsulation? An example in java will help me.
Does encapsulation means only place data in capsule like a class, or does an access modifier have to be there?
I read that encapsulation means to hide and club together data.
In this example:
class A{
public int a;
public void foo(){}
}
Is above code is example of encapsulation? If yes, then there is nothing hidden from outer world as a
and foo
are public. Must a
and foo
be private
for this example to be considered encapsulation?