+ 2
I need help on classes and encapsulation
a detailed paragraph and a code will be helpful thanks!
1 Answer
0
as far my understanding of this question u want to ask that why encapsulation is important. isn't it?
so suppose a member is private, u cannot change without setters. now suppose u have a program in which u need even number inputs how would u determine whether input is correct or not. Using setters u let ur values go through a doable-list to check whether it is correct or not. U can define whether how u want ur values.