Differences between Encapsulation and Abstraction | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Differences between Encapsulation and Abstraction

Hello guys! Im just a novice, and struggling to truly understand these 2 encapsulation and abstraction. Both of them is about hiding internal details of an object. Ive been searching for this on the Internet and someone said: Encapsulation: hiding the details of an object from the outside world Abstraction: represent the important features without representing the background details (complex real world -> simplest manner) If both is to hide details so why do we need encapsulation, plz explain and example

7th Dec 2017, 1:32 AM
Bình Nguyễn Đức
Bình Nguyễn Đức - avatar
4 Answers
+ 1
Yeah! I got it, so encapsulation is like deeper than abstraction right? LoL sorry for my silly comparison. When it comes to coding, the real work of the computer behind the screen is encapsulated from me, so i dont know how it works but i can still use the function... and when i finish coding a program, all the things are abstracted from the users so they can just use it without understand anything else right ^^! Thank u so much
8th Dec 2017, 12:45 PM
Bình Nguyễn Đức
Bình Nguyễn Đức - avatar
0
Actually ur explanation was rather hard to understand, but i get it a lil bit, tks. Btw i think the second part of your second answer should be abstraction ?, idk but just as ur first answer, idk how they grow plants, feed animals... but all the stuff are still the so it should be abstraction?
7th Dec 2017, 4:51 AM
Bình Nguyễn Đức
Bình Nguyễn Đức - avatar
0
I appreciate it man
7th Dec 2017, 3:35 PM
Bình Nguyễn Đức
Bình Nguyễn Đức - avatar
0
I think i didnt totally get this but anw tks a lot man
7th Dec 2017, 4:41 PM
Bình Nguyễn Đức
Bình Nguyễn Đức - avatar