Encapsulation is an object model concept, which allows to hide specific behavior or processing abilities within object instances defined by a class. Method definitions within a class are an integral part of encapsulation, which allows to store data and code together.
For example:
getPilot method can be "attached to" a Car object or encapsulated. Alternatively, getPilot method can be stored in the application or a separate library and distributed with the object database. However, encapsulation approach has an important advantage: method code cannot be lost or outdated as in the case of an application/library storage. Object system recognizes which methods belong to which data. The process of the correct method linking to the object is called dispatching.