|
Your time now: Mon Nov 23, 2009 11:45 am
|
View unanswered posts | View active topics
| Author |
Message |
|
reply4konda
|
Post subject: what is the difference between Encapsulation and Abstraction Posted: Thu Apr 05, 2007 1:45 pm |
|
Joined: Wed Mar 28, 2007 1:56 pm Posts: 3 Location: pune
|
|
What is the difference between Encapsulation and Abstraction,Tell me real time examples.
|
|
| Top |
|
 |
|
ggomez
|
Post subject: Posted: Tue Apr 17, 2007 5:05 am |
|
Joined: Tue Apr 17, 2007 4:30 am Posts: 45 Location: !!!!!MéXiCo¡¡¡¡¡¡
|
|
Encapsulation is when you can use diferents tool from a single object in your program.
for example: Obj o=new Obj();
o.sum(); o.divide() and everything inside the same object.
Abstraction is when you simplify a complicate proccess with a few statement.
for example: o.solveEquation(2,3,5)
with this i wont need to complicate my life every time i need it.
it is encapsulated because its inside an object and its abstract beacause i dont really need to know how to resolve equations.
A good tutorial will do a better job, this is to make the understanding easier.
|
|
| Top |
|
 |
|
skoiloth
|
Post subject: Posted: Wed May 09, 2007 12:25 pm |
|
Joined: Wed May 09, 2007 10:51 am Posts: 6
|
|
Abstaction is selective ignorance where in if you come across a common functionlaity in in any system which differs in some of details which are specific to those particular objects and overall most of the functionlait is common.. So you abtact out all such common functionlaity and put it in one place and just change the functionlaity for specifics. Go through the very draw ,shape , rectangle example from any basic book..
class Person {
private final Date birthdate = ...;
long calculateAge() {
return System.currentTimeMillis() - birthdate.getTime();
}
}
Simplified, this would rather be encapsulation.
_________________
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 3 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
|