Diffrence b/w data abstraction, encapstulation?
diffrence b/w data abstraction,encapstulation?plze explain simple sentences?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhishek JaiswalPosted Dec 20, 2013, 12:54 AM
Both are one of the major pillars of the concept.
Encapsulation can be define as data hiding whereas
abstraction is information hiding. In abstraction method we
do use abstract class.
Jignesh TrivediPosted Dec 19, 2013, 12:33 AM
Please refer my blog
http://www.c-sharpcorner.com/Blogs/9442/abstraction-and-encapsulation.aspx
Nipun TomarPosted Dec 18, 2013, 11:34 PM
ENCAPSULATION
Encapsulate means to hide. It is also called data hiding, used to hide the code and data in a single unit to protect the data from the outside the world. Encapsulation is implemented using private and protected access modifier. Class is the best example of encapsulation.
Example:
Class Encapsulation
{
private int marks;
public int Marks
{
get {return marks;}
set {marks = value;}
}
}
ABSTRACTION
Abstraction refers to showing only the necessary details to the intended user. As the name suggests, it means " to abstract something". We use abstraction in programming languages to make abstract class, which represents abstract view of methods and properties of class. Abstraction is implemented using interface and abstract class.
Example:
abstract class Abstraction
{
public abstract void doAbstraction();
}
public class Abstractionlmpl: Abstraction
{
public void doAbstraction()
{
//Implement it
}
}
Thanks