Major aspects of object-oriented programming

Now that we have understood the basics of object-oriented programming, let's dive into the major aspects of OOP.

Encapsulation

The key features of encapsulation are as follows:

  • An object's behavior is kept hidden from the outside world or objects keep their state information private.
  • Clients can't change the object's internal state by directly acting on them; rather, clients request the object by sending messages. Based on the type of requests, objects may respond by changing their internal state using special member functions such as get and set.
  • In Python, the concept of encapsulation (data and method hiding) is not implicit, as it doesn't have keywords such as public, private, and protected (in languages ...

Get Learning Python Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.