• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

difference between abstraction and encapsulation

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i cound not understand the difference between abstraction and encapsulation. please help
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mahi
 
reply
    Bookmark Topic Watch Topic
  • New Topic