what is data Abstraction? and give example
Answers were Sorted based on User's Feedback
Answer / gaurab varshney
Data Abstraction is the process by which data and programs
are defined with a representation similar to its meaning
(semantics), while hiding away the implementation details.
Abstraction tries to reduce and factor out details so that
the programmer can focus on a few concepts at a time. A
system can have several abstraction layers whereby
different meanings and amounts of detail are exposed to the
programmer.
For example, low-level abstraction layers expose details of
the hardware where the program is run, while high-level
layers deal with the business logic of the program.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sachin
Data Abstraction is the process which represent essential
feature without implementation of details.
Ex. Soccer Ball, Ball is having same structure behavior
like common ball
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / amit singh
Data abstraction is the process of showing necessary
details to the user by hiding the complexity behind them.
real time ex-
T. V remote control we can see the buttons on it but how
the circuitry work after pressing the particular button is
hidden from the user.
even as per java code we can give ex of abstract class
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ravin
data abstraction is a method to represent essential features of a data without including background details or unimportant matter.
a function/process used to define the use of this data.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / swati
data abstraction denote essential feature of an object.. in abstraction make only relivent detail of an object.
example- when u want to snd an e-mail msg,u should know the process of writting e-mail,snding it to the recievr.however it is not necessary for u to know the entire process of sending the emil msg across the n/w
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / apoorva
It is the process of hiding the complexity and inner
workings of a class, so that users dont have to know how it
operates.
For example- You dont have to know how a tv works if you
only wanted to view a picture.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / deep shah
"Abstraction refers to the act of represent essential features without including the background details or explanation".
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / v.santhoshini
*Data Abstraction is a collection of related data items
together with an associated set of operations.
*data operations &relations are studied indpendent of
implementation.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / abelthom
data abstraction is the process of looking at the data at
higher levels without being concerned with the lower levels
(i.e. implementation considerations)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sankalp
abstraction - it is the act of representing the essential features without including the background details.
classes uses the concept of abstraction.
Benefits of Data Abstraction:
Data abstraction provide two important advantages:
Class internals are protected from inadvertent user-level errors, which might corrupt the state of the object.
The class implementation may evolve over time in response to changing requirements or bug reports without requiring change in user-level code.
By defining data members only in the private section of the class, the class author is free to make changes in the data. If the implementation changes, only the class code needs to be examined to see what affect the change may have. If data are public, then any function that directly accesses the data members of the old representation might be broken.
Data Abstraction Example:
Any C++ program where you implement a class with public and private members is an example of data abstraction. Consider the following example:
#include <iostream>
using namespace std;
class Adder{
public:
// constructor
Adder(int i = 0)
{
total = i;
}
// interface to outside world
void addNum(int number)
{
total += number;
}
// interface to outside world
int getTotal()
{
return total;
};
private:
// hidden data from outside world
int total;
};
int main( )
{
Adder a;
a.addNum(10);
a.addNum(20);
a.addNum(30);
cout << "Total " << a.getTotal() <<endl;
return 0;
}
When the above code is compiled and executed, it produces following result:
Total 60
| Is This Answer Correct ? | 1 Yes | 0 No |
What is problem with overriding functions?
Does defining a function inline mean that it wont push and pop things on/off the stack ...like parameters and the return the address??
What are manipulators in c++ with example?
What is ios class in c++?
What is main function in c++ with example?
how can i access a direct (absolute, not the offset) memory address? here is what i tried: wrote a program that ask's for an address from the user, creates a FAR pointer to that adress and shows it. then the user can increment/decrement the value in that address by pressing p(inc+) and m(dec-). NOW, i compiled that program and opened it twice (in 2 different windows) and gave twice the same address to it. now look what happen - if i change the value in one "window" of the program, it DOES NOT change in the other! even if they point to the same address in the memory! here is the code snippet: //------------------------------------------------------ #include <stdio.h> //INCLUDE EVERY KNOWN HEADER FILE #include <conio.h> //FOR ANY CASE... #include <iostream.h> #include <dos.h> #include <process.h> main() { int far *ptr; //FAR POINTER!!! long address; char key=0; //A KEY FROM THE KEYBOARD int temp=0; clrscr(); cout<<"Enter Address:"; cin>>hex>>address; //GETS THE ADDRESS clrscr(); (long)ptr=address; temp=*ptr; //PUTS THE ADDRESS IN THE PTR cout<<"["<<hex<<(unsigned long)ptr<<"]="<<*ptr<<" = "<< (char)(*ptr); //SHOWS: [address]=value=ASCII symbol. while (key!=27) //WHILE YOU DONT PRESS ESC. { while(!kbhit()) //WHILE KEY IS NOT PRESSED { if (temp!=*ptr) { temp=*ptr; clrscr(); cout<<"["<<hex<< (unsigned long)ptr<<"]="<<*ptr<<" = "<<(char)(*ptr); }; //IF THE VALUE HAS CHANGED, CLEAR THE SCREEN AND SHOW //AGAIN if (key=='p') {key=0; (*ptr)++; } //INCREMENT VALUE if (key=='m') {key=0; (*ptr)--; } //DEC. VALUE }; key=getch(); //IF A KEY IS PRESSED, READ IT FROM THE //KEYBOARD }; return 0; //IF ESC WAS THE KEY, EXIT THE PROGRAM } //---------------------------------------------------------
What does ctime() do?
Enter n no. of element and delete value from desire position
show that among any group of five (not necessary consecutive ) integers, there are two with the same remainder when divided by 4.
List the features of oops in c++?
How can I disable the "echo" feature?
what is Member Functions in Classes?