Results 1 to 4 of 4

Thread: Confused in between abstraction and encapsulation

  1. #1
    Join Date
    Nov 2009
    Posts
    62

    Confused in between abstraction and encapsulation

    Hi,

    I have too confused in between abstraction and encapsulation.
    As per my knowledge encapsulation is nothing but the hiding of the data. And abstraction is the "Hiding Implementation".

    I am unable to find out the difference in between them.

    Please help me to find out the solution over this.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Confused in between abstraction and encapsulation

    Hi friend,

    1. Basically encapsulation comprises of information hiding as well as abstraction.

    2. Data encapsulation : Information hiding avoids clients from accessing inside view, in which the abstraction behavior is implemented

    3. Abstraction: Implementation hiding primarirly focuses over the object's outside view.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Confused in between abstraction and encapsulation

    Hi,

    Please go through the below example, Which will demonstrate you the concept of the encapsulation i.e data hiding & abstraction:

    Example:
    public class BoxDemo
    {

    private int ht;
    private int len;
    private int wid;



    public void setLen(int a)

    {
    len = a;
    }

    public void setWidth(int a)

    {
    wid = a;
    }

    public void setHeight(int a)

    {
    ht = a;
    }

    public int displVol()

    {
    System.out.print(len*wid*ht);

    }

    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Confused in between abstraction and encapsulation

    Hi,

    *. Obviously abstraction is confusing because it can be used as an entity as well as process.

    *. The process of enclosing one or more data items into a containeris normally referred as Encapsulation.

    *. Abstraction describes the behavior of the data object.

Similar Threads

  1. What are bridging and MAC Encapsulation Routing definitions?
    By Mohammad_dn in forum Networking & Security
    Replies: 1
    Last Post: 16-11-2010, 08:56 AM
  2. What is Database Abstraction Layer in PHP?
    By Author in forum Software Development
    Replies: 5
    Last Post: 07-03-2010, 04:34 AM
  3. Encapsulation in C++
    By Gaauge in forum Software Development
    Replies: 4
    Last Post: 25-01-2010, 10:18 AM
  4. Don't know what is data abstraction
    By Sarfaraj Khan in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 12:32 PM
  5. Concept of abstraction
    By bharti_rajpal in forum Software Development
    Replies: 3
    Last Post: 25-11-2009, 11:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,905,330.31077 seconds with 16 queries