Object oriented programming
A class keeps some things private and makes others public. A third-party library can prevent consumers using certain methods.
2 Abstraction - the main one
Using encapsulation to hide implementation details. This means that the implementation can be changed without affecting other code. Reduces the amount of code changes in a refactor.
For instance using a class to manage access to a database table.
Reuse code between classes. Usually a more specific class extends a more abstract class. But methods can be overridden also.
Cast a class to a more abstract class that it implements.
For instance might want a list of nodes for a table of contents but these nodes could be either folder nodes or content nodes.