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

Nov 1, 2015 at 4:32pm
Does encapsulation help control the values that are assigned to member variables?

Nov 1, 2015 at 4:42pm
Usually.
Nov 1, 2015 at 4:52pm
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.