Encapsulation is nothing but hiding information also called datahiding... while abstraction denotes the essential characteristics of an object which differentiates from other kinds of object...
Above answer was rated as good by the following members: sripudi, mandeepx81
RE: difference between data encapsulation vs abstracti...
Abstraction means datahideing.That means we use the object wethout knowing the source code of the class.
Encapsulation is a mechanism by which we desigm our class such a way that if we change our class in fuature we dont need to change the classes which are depending on our classes.
RE: difference between data encapsulation vs abstracti...
Encapsulation is nothing but hiding information also called datahiding... while abstraction denotes the essential characteristics of an object which differentiates from other kinds of object...
RE: difference between data encapsulation vs abstraction
Abstraction is used for hiding the unwanted information and giving revelant information.
Eg: Three set of customers are going to buy a bike First one wants information about the style. Second one wants about the milage. Third one wants the cost and brand of the bike.So the salesperson explains about the product which customer needs what. So he hiding some information and giving the revelant information.
Encapsulation is combines one or more information into a component.
Eg: Capsule is mixed with one or more medicine and packed into the tube. so its related and acting in two moducles.
RE: difference between data encapsulation vs abstraction
It is wrong to call Encapsulation as only data hiding. Though this defination is usually taught in school but now according to latest OOPs principles its considered incomplete.
According to the book Design Patterns Explained
At conceptual level:
Encapsulation means any type of hiding. It can be either data behaviour implementation or derived classes or any other thing.
Abstraction means to generalize or conceptualize: to step back from the more concrete to the more conceptual or abstract.
At implementation level: Encapsulation is achieved by inheritance aggregation or composition.
Abstraction is represented by using abstract classes to represent a generalized version of set of related classes.