Data Abstraction in C++:-

👉Data Abstraction is a process of providing only the essential details to the outside world and hiding the internal details, i.e., representing only the essential details in the program.

👉Data Abstraction is a programming technique that depends on the separation of the interface and implementation details of the program.


    1. #include <iostream>    
    2. using namespace std;    
    3.  class Sum    
    4. {    
    5. privateint x, y, z; // private variables  
    6. public:    
    7. void add()    
    8. {    
    9. cout<<"Enter two numbers: ";    
    10. cin>>x>>y;    
    11. z= x+y;    
    12. cout<<"Sum of two number is: "<<z<<endl;    
    13. }    
    14. };    
    15. int main()    
    16. {    
    17. Sum sm;    
    18. sm.add();    
    19. return 0;    

Output:-
Enter two numbers:
3
6
Sum of two number is: 9