OOP interview questions :- What is the difference between Abstraction and Encapsulation ?

preview_player
Показать описание

See our other Step by Step video series below :-

Many developers are confused between Abstraction and encapsulation. If you see the definitions Abstraction means show only what is necessary and encapsulation means hide complexity which looks almost one and the same. In this video we will try to unlead practically the difference between Abstraction and Encapsulation.

Рекомендации по теме
Комментарии
Автор

Do not miss our Interview Question video series

dnfvideo
Автор

Not gonna lie for the first 3 mins I was questioning where this was going. Great vid.

osknyo
Автор

Thank you for this video!
TL;DW or for those who still might not understand:
Abstraction: The concept of allowing the user of your class to have access to only what they need. (Concept)
Encapsulation: The physical code that prevents the user from accessing fields or methods you do not want them to (Actual Implementation)

Good example would be if a user is trying to deposit to an account balance. Account balances can't be negative or over 100, 000, say. So your add function has a check. A user can circumvent these checks by saying obj.balance = -123;

This is bad, so we want to use "Abstraction" to allow user access to only the things we want them to.

So we make balance private, and now the user can only add through YOUR function. The act of making the field private and adding a modifier method is "Encapsulation".

So as Manoj said, Encapsulation implements Abstraction.

naiche.
Автор

I am regularly watching your videos to get theoretical and practical knowledge on C#. I would say I'm a junior developer coding for years but recently from mid of 2022, I took C# seriously. Your videos are helping me to elevate my understanding much higher, and being able to understand in depth. Thank you for your hard work. I will keep watching, share with others, and share my thoughts on each video unless I'm feeling lazy to comment.

kopilkaiser
Автор

Encapsulation: Data Hiding,
Abstraction: Implementation hiding.
Eg Getter/Setter methods are used to access encapsulated attribute data, similarly as in this video example calling a public method wherein other private methods would be executed, would be an abstraction.

DeepayanDas
Автор

This video gives the exact clarity what I was looking for. No confusion now between abstraction and encapsulation 🙂👍👍

ManojDeshwal
Автор

In more than 20 interview I was asked differences and I never explained. Finally I got, Great man..

raushanthakur
Автор

encapsulation is all about data making properites private and making it accessible only through the behavious of the same object.. Thus providing necessary securty to the state of the object.. You cannot miss this point when u differentiate ans and enc.... all other points that you have told i completely agree

anoopkar
Автор

Thank you. This one video helped more than all the theory stuff I read on abstraction and encapsulation. Keep up the good work. Thanks again.

umreddy
Автор

best video on abstraction, even stack-overflow could not make me understand..
thank u

ianshumansingh
Автор

Thank you! I'm a student and this helped me so much understanding what abstraction and encapsulation is.

wendiilu
Автор

Yes practically it's very difficult to explain these two concepts, and this is the very basic. So it's important to get a better feel of these, from the beginning.
Thanks.

Nobo_On_The_Rocks
Автор

And finally i came to know the difference btw Abstraction and Encapsulation.. :)
Great Explanation Sir.. (y)

ravikrishna
Автор

The best explanation i ever heard... perfect and clear...!

karumpilhouse
Автор

Thanks for your clarification..i searched the whole internet and i found this video answering my question.

jeffryjoseph
Автор

Best and simplest explanation of attraction and encapsulation.

SaurinVala
Автор

The last four minutes of the video, was what chnaged my mind. I loved the way you tabled it. Mean explanation. Thank you very much.

joelgaiciyadu
Автор

Thank You soooo much Sir, you have cleared one of my biggest confusion in object oriented paradigm, thank you much.

muhammadwaqas
Автор

Great Representation...And Today i get it in the glance of programming word, that how both works...

mukeshtiwari
Автор

Now, I've got what's the abstraction n encapsulation.... Really nice video.. thnx

SinghDilip-hziq