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
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on whatsapp
WhatsApp
Share on reddit
Reddit
Share on telegram
Telegram

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top