Data Abstraction in C++

Taylor Emma
1 Min Read
Disclosure: This website may contain affiliate links, which means I may earn a commission if you click on the link and make a purchase. I only recommend products or services that I personally use and believe will add value to my readers. Your support is appreciated!

Data abstraction refers to, providing only essential information to the outside word and hiding their background details ie. to represent the needed information in program without presenting the details.

Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation.

For example, in C++ we use classes to define our own abstract data types (ADT). You can use the cout object of class ostream to stream data to standard output like this:

#include<iostream>

usingnamespacestd;

int main()

{

cout<<“Hello C++”<<endl;

return0;

}

Here, you don’t need to understand how cout displays the text on the user’s screen. You need only know the public interface and the underlying implementation of cout is free to change.

Share This Article
A senior editor for The Mars that left the company to join the team of SenseCentral as a news editor and content creator. An artist by nature who enjoys video games, guitars, action figures, cooking, painting, drawing and good music.
Leave a review