What is the primary purpose of encapsulation in object-oriented programming in C++? 

  • Code compression 
  • Memory saving 
  • Hide complexity 
  • Code sharing
Encapsulation is a core concept in object-oriented programming. Its primary purpose in C++ and other OOP languages is to hide the internal representation, or state, of an object from the outside and to bundle the data (attributes) and the methods (functions) that operate on the data into a single unit, thus hiding complexity.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *