by, 04-26-2012 at 07:11 PM (1299 Views)
Within class implementation, this is a coomon thing to refer to the private fields directly. Another style present where all of the internal references present are indirect & further proceedings is done via set & get methods. This is what is known as self encapsulation.
- is required to do the lazy initialization
- is more difficult for reading as compared to the direct field access
- Might be able to develop the synchronization policies, foer the field.
- Permit subclass for overriding set and get methods & definition is also provided regarding the field’s behavior.