Data Abstraction in C++

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.

Related Posts

Comments are closed.

© 2023 Software Engineering - Theme by WPEnjoy · Powered by WordPress