Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Well, I know pointers and setters are hunting dogs, maybe getters should be renamed fetchers?
 
Mutators just sounds so dark and scary! :eek:

I know they're often useful and unavoidable, but when i was being taught OOP they were supposed to be scary. At the time the context was that you had a private/protected variable (if it was public, it would just be accessed directly... not good design, but this was the context we were given) that could be set using a public mutator. To me this seemed like nonsense, if you are letting the variable be set with a public method, why not just make the member public?

Obviously encapsulation, being able to change private variable names, types, etc. in the future, having a standard interface, etc. is the answer, but in this particular course those things were more ephemeral.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.