Data Abstraction,ADT and Information Hiding

Estudies4you

Data Abstraction,ADT and Information Hiding

Q22. What is Data abstraction? Explain.
Answer:

Abstraction
An abstraction is a process of showing relevant details and hiding irrelevant details from the user i.e., the implementation details are completely hidden from the user.
It gives the representation of real-world entities thereby showing only important attributes from the set of attributes.
To form groups from the set of attributes by using abstraction, then while forming the groups, the common attributes have been neglected hence, abstraction reduces the group complexity by simplifying its elements.
There are two types of abstraction. They are,
(i) Process abstraction
(ii) Data abstraction
(i) Process Abstraction
It refers to the way in which the programs must specify some computational process has to be done. without providing the details of computation. ‘
All function/subprograms and exceptional handlers are the examples of process abstraction.
(ii) Data Abstraction
It refer to the way of isolating the data implementation methods from its usage. All the data members of an ADT are related to.data abstraction and the member functions to process abstraction. These two abstraction types are related. to each other.

Program
#include<iostream.h>
#include<conio.h>
class Sub
{
private:
int x,y,z;
public:
void subtraction()
{
cout<<"Enter two numbers:";
cin>>x>>y;
z = x-y;
cout<<"Subtraction is:"<<z;
}
};
void main()
{
Sub s;
clrscr();
s.subtraction();
getch();
}

Output:
Data Abstraction in c++,ADT and Information Hiding in c+,information hiding in c++,Process abstraction in c++,Data abstraction in c++,define class in c++,syntax for class,class syntax,data abstraction in c++,data hiding in c++,what is object,difference between class and object,how to declare a object to class,what is scope of class in c++,types of scopes in c++,estudies4you,pointers in c++,static members of a class in c++,Static Member Function in c++, constructor and destructors in c++,difference between constructor and destructor,define constructor,define destructor,static member functions,data abstraction definition,short notes on data abstraction,types of abstraction in c++,what is ADT in c++,abstract data type in c++,information hiding in c++,
In the above program, ‘x’,‘y’ and ‘z’ are the private data-members and the function is the public member function. An object 's’ of type class is created in the main( ) function and then the member function subtraction( ) is called by using the dot operator.


To Top