What is the difference between encapsulation & abstraction?

Questions by anilktomar

Showing Answers 1 - 5 of 5 Answers

nairvvin

  • Apr 3rd, 2006
 

Encapsulation is internal behavior, while Abstraction is External behavior

Abstraction is mapping real world entity with s/w entity. By writing a class we can implement abstraction.

While Encapsulation is encapsulating all properties with in the class.Using getter, setter methods we can implement encapsulation.

  Was this answer useful?  Yes

g_chetanraj

  • Apr 3rd, 2006
 

encapsulationIt is process of enclosing or wrapping of data and functions with the help of classes is known as encapsulation. Encapsulation provide security to your code. It protect your data from unauthorised access etcAbstraction:is the process by which you will hide unwanted details from the user. It means the details which are needed for the user are only provided to him.

  Was this answer useful?  Yes

Giridhar Reddy

  • Apr 11th, 2006
 

Abstaction is the process of hiding data it

exposes the only essential featuares of an object.

Encapsulation means Data hiding

let us say we have a class with one variables if call a variable with one object it takes a location which is different if u call the same variable with another variable.

class Demo

{

int var;

Demo d1 = new Demo();

Demo d2 = new Demo();

d1.var =10;//here the value 10 stored in a location 1010

d2.var=20;//here the value 10 stored in a location 1020

}

this is called data hiding

  Was this answer useful?  Yes

Deepthik

  • Apr 13th, 2006
 

             Encapsulation is binding the data & methods together, so that only particular methods should access the data.

            Abstraction is the hiding of uncessary data & showing the only necessary data.

  Was this answer useful?  Yes

Avinash Chaturvedi(Avi)

  • Aug 3rd, 2006
 

Abastaction : The Process in which we identify all the relevent attributes and methods related to a perticular entity and finally bind these attribute and methods into a single unit known as class is called data abstraction so the result of abstration is : CLASS so with the data abstraction we implement all the details of a perticular entety into a sigle unit . in other words we just create a type it may be a simple type like POINT or complex type like ACCOUNT for a bank . in other words users of this type not aware to how this type is came into existance and what is the internal working of this type.    

Data Encapsulation : it means we incapsulate all the attribute into a capsule with the help of access specifiers (private/protected) so all the attributes into this capsule are accessible only into the methods of the same unit. so in other words we hide our data from outside world that is encapsulation.   

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions