ENCAPSULATION IN C++

Maha

ENCAPSULATION IN C++

Encapsulation in C++ is defined as the wrapping up of the data and information in a single unit. In Object Oriented Programming, Encapsulation is defined as binding together that the data and the functions can manipulate.

Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties' to  direct access.

Advantages of Encapsulation:

  *   Encapsulation protects an object from unwanted access by clients

  *   Encapsulation allow to access a level without revealing the complex details below the level

  *   It can reduces human errors

  *   Simplifies the maintence of the applications

  *   It makes the application easier to understand


The three different types of ways to implement encapsulation:

👉Member variable encapsulation.

👉Function encapsulation.

👉Class encapsulation.

Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send