Class-based programming
Encapsulation prevents users from breaking the invariants of the class, which is useful because it allows the implementation of a class of objects to be changed for aspects not exposed in the interface without impact to user code.The definitions of encapsulation focus on the grouping and packaging of related information (cohesion) rather than security issues.Barbara Liskov and Jeannette Wing formulated the principle succinctly in a 1994 paper as follows: Subtype Requirement: Let Most current object-oriented languages distinguish subtyping and subclassing, however some approaches to design do not.For class-based languages, this restriction is essential in order to preserve unified view of the class to its users.The users should not need to care whether one of the implementations of a method happens to cause changes that break the invariants of the class.Although Simula introduced the class abstraction, the canonical example of a class-based language is Smalltalk.