Nikumbh
Hi Folks,
Could anyone make me clear the difference between encapsulation and abstraction.
In my POV the difference between Encapsulation and Abstraction is....
Encapsulation : Encapsulation is the way of integration like object+dataMember into a single unit. Where the data is hidden...
Abstraction : Hiding the implementation of the business logic...
Need a good guidance over this topic.
See, Encapsulation is an OOP feature, when you bind all your data members and associated member functions, under a single unit.
This is done through Class.
Eg:
class test
{
int a,
char b[10];
public:
int check();
}
Here, a and b are data members, where as check is some method, so you have all this defined under a single unit, ie class here.
This is encapsulation.
Abstraction refers to data hiding, which is done through access levels namely private, public and protected for C++ , and for java there is private, protected, public and default levels.
Sometimes, we want to give only essential details, without giving out all the background details.
In the above example, class by default has a private access level, so the data members, a and b are kept private, where as the function is made public.
These things sound more clear when you learn about inheritance.