.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Forum >> OOPS >> Post New QuestionBookmark and Share Subscribe to Forum

Encapsulation Vs Abstraction

Posted By: Karthikeyan Anbarasan     Posted Date: January 01, 2011    Points:2   Category :OOPS
Can some explain the difference between Encapsulation Vs Abstraction and give some real time example

Author: Asha.MP             
Posted Date: January 12, 2011     Points: 5   


Encapsulation is like your bag in which you can keep your pen, book etc
means this is the property of encapsulating members and functions.

Class bag
end class

Abstraction is the abstraction common thing
ex: if some body in your collage tell you to fill application form, you will fill your details like name, address, data of borth, which sem, percentage you have got etc..

if some doctor give you an application to fill the details, you will fill the details like name,address,doat of birth, blood group, height and weight

see in the above example what is the common thing??
age, name, address so you can create the class which consist of common thing, that is called abstruct class.

That class is not complete and it can can inhetited by otherclass,

Thanks and Regards,
Author: Harsha             
Posted Date: June 07, 2011     Points: 20   

In simpler words, Encapsulation means hiding the details.

Abstraction means selective display of only related information to the user.
Harsha, Bengaluru.

Author: Vinodh             
Posted Date: September 16, 2011     Points: 20   

class Car
public int seats;
public void inceaseSpeed()
Console.WriteLine("Speed increased");
public void decreseSpeed()
Console.WriteLine("Speed decreased");

class Program
static void Main(string[] args)
Car mycar = new Car();
mycar.seats = 4;


Encapsulation: seats, inceaseSpeed() and decreseSpeed()are encapsulated in car
Abstraction:inceaseSpeed() and decreseSpeed() ,driver need not know how they work

Author: Baimey Rajesh             
Posted Date: August 01, 2012     Points: 20   

encapsulation is wrraping up of a data into single unit
abstraction is hidding unnesecary background details and representing only important and essential detail

Encapsulation is information hiding. Abstraction means working on a higher level, not worrying about the internal details.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend