Does encapsulation help control the values that are assigned to member variables?

Does encapsulation help control the values that are assigned to member variables?

Usually.
IMO, yes.

Member variables have valid ranges and possibly interdependency with other member variables - in other words the class invariants.

By having a member function that deals with those variables, the invariants can be checked.
Topic archived. No new replies allowed.