Encapsulation, when to use and when not...

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
In general when I build a class that has fields I want to able to access I always encapsulate them.  My philosophy up to this point has been to encapsulate every field unless I can think of an explicit case where this would become a problem.  Havent given it much thought up until now, and I am wondering if I may be missing some key point and am <span style="font-size:8pt;color:black;line-height:115%;font-family:Verdana,sans-serif unnecessarily creating a bunch of get/set code when I dont really need to.  I would be interested in others folkss take on this. Thanks

View the full article
 
Back
Top