Answered On : Nov 16th, 2005
View all questions by venkatesh View all answers by venkatesh
encapsulation is the concept of grouping of datamembers and member functions.Data hiding means we cannot use the datamembers out side of the class.
Answered On : Nov 24th, 2005
Hi,
Please give me the detail explanation on the Encapsulation and Data hiding with example.
It is the mechanism that binds together code and data in manipulates, and keeps both safe from outside interference and misuse. In short it isolates a particular code and data from all other codes and data.
ex:
Class Base
{
int a=1;
Public void fun1{}
}
Abt data hiding,we access the data from a class in a secure way using the object.
Encapsulation:
when u used format specifiers, public, private and protected. Basically u r defining scopes so encapsulating them.
Data Abstraction:
But when once u have made ur porgram, you dont give ur code to ur user but exe. so here ur hiding ur data .. this is often said as data abstraction.
so as a recall
PRIVATE PUBLIC = encapsulation
EXE not CODE = data abstraction.
Answered On : Apr 20th, 2006
Hey....
Can we say that we can achieve data hiding with the help of encapsulation...?? please correct me if I am wrong....
Answered On : May 5th, 2006
Deasr Sir/Madam
I m requesting u that please mail answer of some certain Question.
what is the difference between encapsulation and Abstraction.
How can we change the value type to reference type.
regards
Nitya
Answered On : May 27th, 2006
Encapsulation is the inclusion all the resources needed for the object to function - basically, the method and the data. information hiding is one technique used to accomplish encapsulation of an object.Information hiding is when you remove data, methods or code from a class's public interface in order to refine the scope of an object.
In simple terms, Encapsulation is am implementation of the data abstraction(data hiding). Data hiding is conceptual while encapsulation is how u implement that concept logically.
ENCAPSULATION : WHEN IS ARE DECLARING A CLASS WE ARE DOING ENCAPSULATION.
DATA HIDING: WHEN WE PROVIDE ACCESS SPECIFIER TO THEM LIKE (PRIVATE PROTECTED,PACKAGE PROTECTED, PUBLIC) WE ARE HIDING THE DATA FROM MISUSE.
PLEASE COMMENT...
Answered On : Dec 22nd, 2006
what is the difference between encapsulation and datahiding.explain with example
Answered On : Jan 2nd, 2007
Data encapsulation is the most striking feature of a class.It isolates a particular code and data from all other codes and data.
Hiding means insulation of data from direct access by the program.
Answered On : Feb 6th, 2007
hi dear.,Abstraction, information hiding, and encapsulation are very different, but highly-related, concepts. abstraction is a technique that helps us identify which specific information should be visible, and which information should be hidden. Abstraction can be (and often is) used as a technique for identifying which information should be hidden. For example, in functional abstraction we might say that it is important to be able to add items to a list, but the details of how that is accomplished are not of interest and should be hidden. Using data abstraction, we would say that a list is a place where we can store information, but how the list is actually implemented (e.g., as an array or as a series of linked locations) is unimportant and should be hidden. Encapsulation is then the technique for packaging the information in such a way as to hide what should be hidden, and make visible what is intended to be visible. ------------------------------- Confusion can occur when people fail to distinguish between the hiding of information, and a technique (e.g., abstraction) that is used to help identify which information is to be hidden. -----------------------------------"[Information hiding is] the principle that users of a software component (such as a class) need to know only the essential details of how to initialize and access the component, and do not need to know the details of the implementation." check this link http://www.itmweb.com/essay550.htmu ll definitely get a clear idea about Encapsulation Data Hiding Abstraction...........
Answered On : Apr 8th, 2007
Abstraction - This term is used when you have a hierarchy of classes with an abstract class(interface in langauges other than C++) on top. An abstract class tells the users(developers who use the systems with the help of hierarchy) what methods they can call. Ofcourse only public members are accessible to the users.
Encapsulation - This is the actual implementation of the abstract class. Now you can have a hierarchy with various classes and their subclasses implementing the interface. However, to the user.. its only the abstract class that they can call ur system with.
Data Hiding - This comes at the private/protected/public level of access modifiers.
I believe the difference between these terms become more clear when you look from other languages than C++ as C++ doesnt have anything as interface.
Answered On : Aug 21st, 2007
Encapsulation is nothing but binding both data members and member functions that operates on that data into single entity called Class. so that One object's data is separated from other object so that is called as DataHiding that can be achieved using access specifiers.
But when once u have made ur porgram, you dont give ur code to ur user but exe. so here ur hiding ur data .. this is often said as data abstraction. so as a recall PRIVATE PUBLIC = encapsulation EXE not CODE = data abstraction.
Encapsulation is a technique of combining the "data" and the "code" which acts on data, whereas datahiding is just protecting the data from direct outside access.
Example:
class MyClass
{
private string name = "Nitin";
private int age = 26;
public string GetDetails()
{
retrurn "My name is "+ name +" and I am "+age+ " Years old";
}
}
here,
MyClass is encapsulating two members and a function
and any outside object cannot access "name" and "age" directly
Encapsulation => Data + member in a Class. not necessairly Public private.
Abstraction => Data + member in a Class. Buthide the data that you dont want to use outside the class. make the things private that you dont want to show to client...
Data hiding is done by using access specifier and data encapsulation is wrapping of data which use default specifier.
Encapsulation: It is a concept in which we group together all the data members and member methods together like different medicines putted together in a single capsule.
So, our java class is an example of encapsulation.
Data hiding: It comes from the concept of encapsulation in which we try to hide the all the information within the class from outside the class. It is basically used for the security purpose in which we try to protect the data members of consistency. that is, making it difficult to change the consistent data directly from outside the class.
Also, try to make it difficult for users that what the class is using so that it will be difficult to change function of the methods from outside.
Data abstraction: Simply, hiding the unnecessary information. So, we show only what we can do with the class instead of how does it work. Very common example is the Car class. where we can use the class without knowing the detail of the car i.e. detail of the engine used in the car, or other information like gear making company. here we only use the engine with knowing how much horse power it is, and how many gear it has.
Creating a Class is an example for encapsulation. Here we are making the data and related actions (or methods or functions) into a single "capsule". Or I wud say we are encapsulating the data with related functions.
The encapsulation is methodology that helps hide internal data of a class.
Answered On : Jul 22nd, 2011
encapsulation is collection of objects in a single classes.
data hiding(or)data abstraction is giving main details of the data without showing all details of the data.
Answered On : Sep 4th, 2011
Data encapsulation is the process of binding data members and member functions that manipulates that data. It keeps the data from external interference and misuse.
Data hiding is the process of hiding data from the other classes. We can hide the data by using address specifier private and protective.
Answered On : Sep 7th, 2011
encapsulation means wrapping up of data into a corresponding memberfunctions into a single unit.where as datahiding means to hide the data
Answered On : Dec 12th, 2011
Encapsulation means to bind the data and functions into a single unit.OOPs treated data as an object, its primary deals with security of data rather than procedure.Wrapping Up of data in a single unit is known as Encapsulation.
Data Abstraction is the process of defining only the essential features without explanation of background.
e.g: "Switch Board" in which we just see the Switch not their connectivity to the Wires........
Answered On : Dec 19th, 2011
The process of binding data and function is encapsulation the process of hiding the data from direct access by the program is data hiding.
Answered On : Jan 4th, 2012
Enacapsulation is bing the data type and member function into a single name called class name. for example: Consider this code:
The above code called encapsulation Data hiding in which the properties of class members are hide outside the class. for example:Code
class a { private: int a; public: void a(); }
The above code int a; declared inside the private block so we dont use outside the class.Code
class a { private: int a; public: void a(); };
Answered On : Jan 4th, 2012
Wrapping up of data and function in a single unit is called encapsulation.
Answered On : Mar 14th, 2012
encapsulation is the concept of the datamember. Data Hiding is the Access Specifier.
Answered On : May 12th, 2012
encapsulation is the wrapping up of data members and data functions into a single unit like classes. here we can control the visibility of data with the help of access specifiers i.e. public,private and protected.
in data hiding data is totally private we cannot access the data.
Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.
