Encapsulation Flashcards
1
Q
What is ENCAPSULATION?
A
Making the atributes (variables) in a class private and providing access to those atributes via public behaviours (methods)
2
Q
What are the ADVANTAGES of ENCAPSULATION?
A
- Data Hiding
- Increased Flexibility
- Reusability
- Testing code is easy
3
Q
What is DATA HIDING?
A
The user will have no idea about the inner implementation of the class (implies security)
4
Q
What is INCREASED FLEXIBILITY?
A
We can make the variables of the class as read-only or write-only depending on our requirement
5
Q
What does REUSABILITY mean?
A
Methods can be copied to different/new classes and help meet new requirements
6
Q
How does it allow for EASY TESTING CODE?
A
It is easier to fix larger programs if you know which method is returning the wrong response