I was asked to explain what encapsulation is, and I replied: "Combining data and functions that modify this data is called encapsulation."
The answer was followed by another question: "So, by your definition, if I change a global variable from a member function of a class, then encapsulation is broken."
It made sense to answer YES.
I am not sure if my explanation is incorrect or whether the following question is valid, and my answer to it as YES is correct.
Can someone help.
pasha source
share