Originally posted by Ilja Preuss:
Seems like there actually is no generally agreed upon definition of both terms... :roll:
As is true of so much terminology!!!
Yet another way that I've talked about encapsulation is as a
benefit of information hiding: namely, if we change a private detail -- data structure or internal workings of a method -- of a class, then the changes are "encapsulated"/bounded/contained within the class itself -- i.e., there are no "ripple effects" on the application as a whole.
Looking up encapsulation on
dictionary.com, I found:
1. The condition of being enclosed (as in a capsule);
2. The ability to provide users with a well-defined interface
to a set of functions in a way which hides their internal
workings. In object-oriented programming, the technique of
keeping together data structures and the methods (procedures)
which act on them. Best,
J.
[ July 15, 2005: Message edited by: Jacquie Barker ]