What is the difference between Abstraction and Encapsulation

Posted by Singarapu_kranthi under Others on 8/31/2010 | Points: 10 | Views : 100891 | Status : [Member] | Replies : 9
It is really confusion with these two conepts (Abstraction and Encapsaltion). Please tell the difference with a real world example.




Responses

Posted by: Shankul2784 on: 8/31/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Abstraction is the class where we are defining abstract methods or defines the methods with body. We are not creating instance for the abstract classes. Encapsulation means wrapping of variables & methods in the class.

Thanks & Regards,

Shailesh

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: SheoNarayan on: 8/31/2010 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Read Encapsulation at http://www.dotnetfunda.com/articles/article511-what-is-encapsulation-.aspx

Read Abstraction at http://www.dotnetfunda.com/articles/article632-what-is-an-abstraction-.aspx

Hope this help.


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Laghaterohan on: 9/1/2010 [Member] Starter | Points: 25

Up
0
Down
Hi,

Encapsulation and Abstraction both are interrelated terms.

Encapsulation refers to encapsulating something..Encapsulate means to hide. You can think Encapsulation like a capsule ( medicine tablet) which hides inside itself all the medicie.
The best example of an Encapsulation is of Property ( Get /Set accessors)

Abstraction refers to showing only the necessary details to the intended user.

I hope this clears your confusion atleast little bit.

* You can also refer Head First's Object oriented programing book to clear the concepts in detail.

Thanks,
Rohan



Best Regards,
Rohan Laghate

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 9/6/2010 [Member] Starter | Points: 25

Up
0
Down
Hi,
Check the following link for more information

http://www.csharpcorner.com/UploadFile/tusharkantagarwal/objectorientedcsharp11162005070743AM/objectorientedcsharp.aspx

Syed Shakeer Hussain

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 9/7/2010 [Member] Starter | Points: 25

Up
0
Down
Hi
I will give you answer in simple terms.

abstraction is as name suggest " abstract form of anything"
we are using this term in programig for class as abstract class. that class represents abstract view
of methods and propreties of class.


encapsulation is wrapping. just hiding properties and methods.
class is best example of encapsulation.


that easy it is!

Happy Programming!!
Rohi

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Selvi on: 9/14/2011 [Member] Starter | Points: 25

Up
0
Down
hai....thank you for mention this link.It will very useful to me.

s.selvi

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Selvi on: 9/14/2011 [Member] Starter | Points: 25

Up
0
Down
Abstration:
Abstration is used for hide the data and giving relevant information.
It solves the problem in desing level itself.
Encapsulation:
Encapsulation is used for hide the code and data in a single unit to protect the data from the outside the world.
It solves the problem in implementation level.

s.selvi

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: debal_saha-9451 on: 9/22/2013 [Member] Starter | Points: 25

Up
0
Down
Please have a look on this link
http://silverlightpractice.blogspot.in/2013/09/difference-between-data-encapsulation.html

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/23/2013 [Member] Starter | Points: 25

Up
0
Down
Hi, I hope my answer will now onwards remove your confusion.

You must have heard about capsule. It means it binds/cover something. Called as capsulation. And if any entity bindings something that is encapsulation. So if you are binding something in one function or class than it is called as Encapsulation.

And ab Abstraction is to use that Capsule. :P

So in programming term if you are making a Class than it is known as an Encapsulation and you are accessing it through object than it is called as Abstraction. :)
Singarapu I think you it totally clear. :) Please mark it as answer


IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Singarapu_kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response