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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nipun TomarRank #90 · 23K reputationPosted Dec 18, 2013, 6:34 PM EST
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
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 18, 2013, 7:33 PM EST
Please refer my blog
http://www.c-sharpcorner.com/Blogs/9442/abstraction-and-encapsulation.aspx
Abhishek JaiswalRank #126 · 17.5K reputationPosted Dec 19, 2013, 7:54 PM EST
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.