Abstraction and Encapsulation in python real-world example

Abstraction in python :

in python abstraction. Abstraction is used to hide the internal functionality of the function from the users. The users only interact with the basic implementation of the function, but inner working is hidden for the user. and the user can not understand the internal activity of function. User is familiar with that “what function does” but they don’t know.

A real-world example of abstraction in python :

In Python, suppose a person came to the ATM and he took out the money, he took out the money but he does not know what is going on inside that ATM. That person can see only the work of the outside, nothing is visible from under him. All that work is not visible to him, this is called abstraction.

Encapsulation in python :

Encapsulation in Python is the process of wrapping up variables and methods into a single entity.In programming, a class is an example that wraps all the variables and methods defined inside it.

A real-world example of Encapsulation python :

Consider the below real time example: Encapsulation: As a driver you know how to start the car by pressing the start button and internal details of the starting operations are hidden from you. So the entire starting process is hidden from you otherwise we can tell starting operation is encapsulated from you.

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on reddit
Share on telegram

Leave a Comment

Your email address will not be published.

Scroll to Top