Encapsulation

  • Encapsulation restricts the access to data within the object.
  • This protects the object data from unwanted modifications.
  • For accessing data, we can provide methods to manipulate them.

Object Data Manipulation Methods

  1. Accessor/Getter - data retrieval
  2. Mutator/Setter - data modification

Encapsulation Matrix

Service Method

  • Has the public modifier
  • Methods to provide service for the other objects to use.

Support Method

  • Has the private modifier
  • Assist in public methods in providing the service.
  • Used inside public methods