#1 Agenda
The following topics shall be discussed in this presentation:
Encapsulation
Inheritance
Polymorphism
Association
Aggregation
Composition
#2 Basic Definition of the term Encapsulation:
“Encapsulation refers to the condition of being enclosed, as in a capsule.“
Relating the Encapsulation concept with a capsule really helps in associating the word “encapsulation” with what it actually means, also it benefits in recalling the definition and the idea later on.
In essence Capsule is a one word definition for Encapsulation.
#3 This is how you achieve Encapsulation by bundling appropriate attributes and methods, i.e. by creating a class.
The class diagram shows attributes to be privately accessible while all the functions are public.
#4 Changes made to the code creates maintainability issues.
Usually fields in a class are changed more often than the class’s constructors or methods.
Encapsulation makes sure that when fields are changed, necessary changes can comparatively easily be done in the same class, and this change remain local to that class only, eliminating the chances of an external class being modified.