Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between abstraction and encapsulation

 
naveen jayant
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i cound not understand the difference between abstraction and encapsulation. please help
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, have you tried Google or Wikipedia or books you have on hand? If you can describe what you think they mean, we'll talk about what you have, but we're not likely to do the whole job for you. Let us know what you find!
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well,what i can i say in difference about abstraction and encapsulation is



Abstraction:-This is just showing the essential features in your program.

Encapsulation:-This is hiding all the important features in program ie encapsulating the important data.

I hope you understand.
 
nitin goswami
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abstraction: For example, A 'Person' is not an 'Animal'. We can prove it by abstraction.
Drawing a line and Defining an Object's Property and Behaviour is Abstraction.

Encapsulation: After drawing a line and defining the properties and behaviour, now Hidding internal details of particular behaviour and hidding certain properties is encapsulation. Example: if you kick a dog he bites. This is the behaviour of a dog and we should be least bothered about how he will bite rather should be conceren about the fact that if we kick him, he bites.


This is my understanding about these concepts. May this helps.

Comments or Suggestions are always welcome!!!

Regards,
- Nitin
 
Mahi Rahman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An abstract class doesn't have any body. It's an "agreement" that the class (where this abstract class is implemented) is going to use all the methods of abstract class. It it does not do so then that also has to be an abstract class.

On the other hand, encapsulation is hiding the program logic from the end-user. Using encapsulation improves the security and privacy of the system.

For more understanding, I suggest you read a good object oriented text book.

Regards, Mahi.
 
naveen jayant
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mahi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic