Encapsulation in C++ and C


Encapsulation is a set of tools which can restrict access to data or methods that can manipulate it. Detailed definition of encapsulation can be found in my previous Medium post here. This article is focused on examples of encapsulation in C++ and C programming languages.

Encapsulation in C++

By default, data and methods in class are private — visible and modifiable only by object/class. Access level can be set to other values using appropriate key words provided by C++.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store